0.0
No commit activity in last 3 years
A long-lived project that still receives updates
A gem for calling the Identity API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

>= 5.0, < 8.0
>= 2.0, < 3.0
 Project Readme

Ruby Client for the Identity API

A Ruby client for the Identity >= v2 API.

Installation

Add this line to your application's Gemfile:

gem 'identity_crm'

And then load it into your application:

require 'identity_crm'

Initialising the client

The client is initialised with a user, a token and the url of the Identity server.

@client = IdentityCRM::Client.new(
  user: ENV["IDENTITY_API_USER"],
  token: ENV["IDENTITY_API_TOKEN"],
  url: 'http://localhost:5000'
)

GET requests

You can get details about one or many resources in the API by calling the #get method.

Getting a single resource

To request a single resource, use the #get method:

@client.members.get(member_id)

A call to get returns an instance of the resource:

@client.members.get(member_id).first_name

Some resources can also be requested with alternative parameters

@client.members.get(params: { guid: 'abc123' })
@client.members.get(params: { email: 'test@example.com' })

POST requests

Resources are created in the API by calling the #create method with the body passed through params key.

Creating a single resource

@client.members.create(params: {
  email: 'test@example.com',
  first_name: 'Yoelo',
  last_name: 'Svenslol',
})

Request options

The options hash can be passed with options for the request. Currently supported settings are: timeout.

@client.members.get(
  params: { guid: 'abc123' },
  options: { timeout: 0.5 }
)