Sha256: 0a87159e3260a8c6ce996d02e38ca4c882848d1a84050a682e2a39b04206fa92

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# Chord OMS

These classes provide simple read and write access to the Chord OMS API. Get started like this:

    CHORD_API_CONFIG = {
      staging: {
        base_url: 'https://<customer>.staging.assembly-api.com/api/',
        api_key: '<key>'
      },
      production: {
        base_url: 'https://<customer>.assembly-api.com/api/',
        api_key: '<key>'
      }
    }

    u = Chord::User.find(1)                   # fetch user
    u.attributes                              # see attributes hash
    u.update(name: 'New Name', notes: 'Etc')  # update attributes
    u.update(metadata: {ambassador_id: 415})  # when updating 'metadata' attribute, the given
                                              # hash is merged into the existing value and
                                              # keys and values are stringified (since
                                              # metadata is stored in OMS as a JSON string)
    u.add_role(3)                             # add role (by ID) to the user
    u.remove_role(3)                          # remove role (by ID) from the user
    u.subscriptions                           # fetch the user's subscriptions

Objects are constructed in a way that minimizes API calls but occasionally yields objects that seem incomplete. For example:

    u = Chord::User.find(44)
    s = u.subscriptions.first
    s.user

will return a Chord::User object with only two attributes (ID and email) because the API only returns two attributes with a Subscription object.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
chord-0.0.1 README.md