README.md in chord-0.0.7 vs README.md in chord-0.0.8
- old
+ new
@@ -5,19 +5,20 @@
Chord.config(
base_url: 'https://<customer>.staging.assembly-api.com/api/',
api_key: '<key>'
)
- u = Chord::User.find(1) # fetch user
+ u = Chord::User.find(1) # fetch user by ID
u.email # view an attribute
u.attributes # see all attributes (returns hash)
u.update(name: 'Joe Smith', notes: 'Etc') # update attributes
u.add_role(3) # add role (by ID) to the user
u.remove_role(3) # remove role (by ID) from the user
+ u.orders # fetch the user's orders
u.subscriptions # fetch the user's subscriptions
- o = Chord::Order.find(1) # fetch order
+ o = Chord::Order.find('R87234695') # fetch order by ID
o.subscription_installment? # was the order a subscription installment?
o.subscription_start? # did the order start a subscription?
For complete/current list of supported objects and methods, please see the code.
@@ -26,16 +27,14 @@
The most basic way to get a collection of objects:
Chord::Order.all
-You can also filter and sort, though the parameters are not well documented:
+You can also filter results by using `where`:
- Chord::Order.where(
- 'q[completed_at_gt]' => '2022-09-14',
- 'q[s]' => 'completed_at desc'
- )
+ Chord::Order.where('q[completed_at_gt]' => '2022-09-14')
+ Chord::User.where('q[spree_roles_id_in]' => 8)
## Object attributes
Objects are constructed in a way that minimizes API calls but occasionally yields objects that seem incomplete. For example:
@@ -48,21 +47,21 @@
o.expand!
# Configuration options
-To get your sensitive config data out of your code, you can put it in a YAML file, like so:
+To get configuration data out of your code, put it in a YAML file, like so:
# chord_config.yml
base_url: https://...
api_key: ...
and load it by calling:
Chord.config_from_file('chord_config.yml')
-Or you can put your configuration in environment variables:
+Or put your config in environment variables:
CHORD_BASE_URL=https://...
CHORD_API_KEY=...
and load it by calling:
@@ -75,5 +74,6 @@
# To Do
* tests should use mocks instead of real API requests
+* support more objects and methods