How can I increment tracked items via the Rails client?
I'm able to get my tracked items value via the Rails console:
CHEDDAR_CLIENT.get_customer(:code=>'Test Company').customer_subscription[:items]['users'][:quantity]
(where CHEDDAR_CLIENT is my auth config), but I've tried just about every permutation I can think of and I can't figure out how to change this value with the edit_customer API method. Can you please provide an example as to how I can do this?
In general, the support docs are wonderful, I love the request dictionary, but there seems to be a significant barrier between translating requests to formatting actual API calls. I had to look at the actual source code for the Rails wrapper to see that "Update a Subscription" utilizes the "edit_customer" method, and looking at the example provided in the source code:
#https://cheddargetter.com/developers#update-customer-subscription
#
#id_hash: {:code => customer_code} OR {:id => customer_id}
#
#data:
#
#{
# :firstName => not_required,
# :lastName => not_required,
# :email => not_required,
# :company => not_required,
# :isVatExempt => not_required,
# :vatNumber => not_required,
# :notes => not_required,
# :firstContactDatetime => not_required,
# :referer => not_required,
# :campaignTerm => not_required,
# :campaignName => not_required,
# :campaignSource => not_required,
# :campaignMedium => not_required,
# :campaignContent => not_required,
# :metaData => { #not_required
# :any_user_defined_value => not_required
# },
# :subscription => { #not_required
# :planCode => not_required,
# :changeBillDate => not_required,
# :ccNumber => not_required_unless_plan_change_from_free_to_paid,
# :ccExpiration => not_required_unless_plan_change_from_free_to_paid,
# :ccCardCode => not_required_unless_plan_change_from_free_to_paid,
# :ccFirstName => not_required_unless_plan_change_from_free_to_paid,
# :ccLastName => not_required_unless_plan_change_from_free_to_paid,
# :ccCompany => not_required,
# :ccCountry => not_required,
# :ccAddress => not_required,
# :ccCity => not_required,
# :ccState => not_required,
# :ccZip => not_required_unless_plan_change_from_free_to_paid
# },
#}
It is not clear how I get at tracked items. Is that "metaData"? Doing the following for the Rails wrapper:
$ grep -ri "tracked" *
doesn't return any results, so if "metaData" is indeed tracked items, I think it would be super helpful for the language to match, and for there to be examples galore not only of the concepts, but something that represents the actual data structures used by the API.
Could it be that there is some missing documentation or extra nice stuff to make my life easier since the Rails gem (https://github.com/expectedbehavior/cheddargetter_client_ruby) seems to be a little old now? The following no longer works:
$ gem tumble
This command is deprecated, Gemcutter.org is the primary source for gems.
and I had to add crack to my Gemfile manually.
Discussions are closed to public comments.
If you need help with Cheddar please
start a new discussion.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
1 Posted by Joe Auty on 13 Sep, 2014 03:10 AM
I was looking at the wrong method. set_item_quantity was what I needed. It looks like this was mostly a language issue.
response = CHEDDAR_CLIENT.set_item_quantity({ :code=>'Test Company', :item_code => 'Users' }, { :quantity=>2 } )
It looks like my best bet is to try to connect dictionary methods to API calls as best I can, knowing that they won't always correspond directly (e.g. update customer = edit customer), but knowing that I don't need to do the contortions I was trying to do, and just trying to match up the language will help!
2 Posted by Jess Pendley on 15 Sep, 2014 01:33 PM
Awesome. If you need anything else, let us know.
Thanks!
Jess Pendley closed this discussion on 15 Sep, 2014 01:33 PM.