identity_crm 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +84 -0
- data/lib/identity_crm/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aef4f14514fbacb7185dda93be21ccbd7b4cd5ca
|
4
|
+
data.tar.gz: 487ee335ae2010a9cbd4d2c7855c22b2104b6a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8e53a51bd681a943c017044690ffb69c363e085894ebb0773556856311bc43b4c98ec245e6db0a35d416a4790a0f8532598386bc24d1b01549954859dc8d866
|
7
|
+
data.tar.gz: 6d3d6ff96eb08d7ae5d39f487ebfb0cde864dd7d7016cad18ef3f44b9b7844c73d669359345ab23e8b4a8157541815f8d973628a00f47d8345b7f7df8c01db28
|
data/README.md
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
# Ruby Client for the Identity API
|
2
|
+
|
3
|
+
A Ruby client for the Identity >= v2 API.
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'identity_crm'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then load it into your application:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
require 'identity_crm'
|
17
|
+
```
|
18
|
+
|
19
|
+
### Initialising the client
|
20
|
+
|
21
|
+
The client is initialised with a user, a token and the url of the Identity server.
|
22
|
+
|
23
|
+
```rb
|
24
|
+
@client = IdentityCRM::Client.new(
|
25
|
+
user: ENV["IDENTITY_API_USER"],
|
26
|
+
token: ENV["IDENTITY_API_TOKEN"],
|
27
|
+
url: 'http://localhost:5000'
|
28
|
+
)
|
29
|
+
```
|
30
|
+
|
31
|
+
### GET requests
|
32
|
+
|
33
|
+
You can get details about one or many resources in the API by calling the
|
34
|
+
`#get` method.
|
35
|
+
|
36
|
+
#### Getting a single resource
|
37
|
+
|
38
|
+
To request a single resource, use the `#get` method:
|
39
|
+
|
40
|
+
```rb
|
41
|
+
@client.members.get(member_id)
|
42
|
+
```
|
43
|
+
|
44
|
+
A call to `get` returns an instance of the resource:
|
45
|
+
|
46
|
+
```rb
|
47
|
+
@client.members.get(member_id).first_name
|
48
|
+
```
|
49
|
+
|
50
|
+
Some resources can also be requested with alternative parameters
|
51
|
+
|
52
|
+
```rb
|
53
|
+
@client.members.get(params: { guid: 'abc123' })
|
54
|
+
```
|
55
|
+
|
56
|
+
```rb
|
57
|
+
@client.members.get(params: { email: 'test@example.com' })
|
58
|
+
```
|
59
|
+
|
60
|
+
### POST requests
|
61
|
+
|
62
|
+
Resources are created in the API by calling the `#create` method with the body passed through `params` key.
|
63
|
+
|
64
|
+
#### Creating a single resource
|
65
|
+
|
66
|
+
```rb
|
67
|
+
@client.members.create(params: {
|
68
|
+
email: 'test@example.com',
|
69
|
+
first_name: 'Yoelo',
|
70
|
+
last_name: 'Svenslol',
|
71
|
+
})
|
72
|
+
```
|
73
|
+
|
74
|
+
|
75
|
+
### Request options
|
76
|
+
|
77
|
+
The `options` hash can be passed with options for the request. Currently supported settings are: `timeout`.
|
78
|
+
|
79
|
+
```rb
|
80
|
+
@client.members.get(
|
81
|
+
params: { guid: 'abc123' },
|
82
|
+
options: { timeout: 0.5 }
|
83
|
+
)
|
84
|
+
```
|
data/lib/identity_crm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: identity_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Joel E. Svensson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -52,6 +52,7 @@ extensions: []
|
|
52
52
|
extra_rdoc_files: []
|
53
53
|
files:
|
54
54
|
- LICENSE
|
55
|
+
- README.md
|
55
56
|
- identity_crm.gemspec
|
56
57
|
- lib/identity_crm.rb
|
57
58
|
- lib/identity_crm/client.rb
|