chartmogul-ruby 3.0.2 → 3.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +1 -1
- data/changelog.md +7 -0
- data/chartmogul-ruby.gemspec +2 -1
- data/fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/creates_contact_correctly.yml +134 -0
- data/fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/destroys_contact_correctly.yml +99 -0
- data/fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/merges_contact_correctly.yml +105 -0
- data/fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/paginates_correctly.yml +133 -0
- data/fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/updates_contact_correctly.yml +102 -0
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/creates_a_contact_belonging_to_the_customer_correctly.yml +72 -0
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/lists_the_contacts_belonging_to_the_customer_correctly.yml +72 -0
- data/lib/chartmogul/api_resource.rb +1 -1
- data/lib/chartmogul/concerns/pageable_with_cursor.rb +14 -0
- data/lib/chartmogul/contact.rb +69 -0
- data/lib/chartmogul/customer.rb +8 -0
- data/lib/chartmogul/version.rb +1 -1
- data/lib/chartmogul.rb +3 -0
- metadata +28 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab4919c76f5171e56a194669e8b74fca6493ff75471a16f91ba0d75ff0465221
|
4
|
+
data.tar.gz: 68a1c21253bf2198caa041d22dfb459dfafbae69073d098923f71d0854b0a8e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58b6b5379791fbd767466e3a841e1e4f2951e50896a8ef44c17ea04ff789ca6bc106c5a54733539e2232ec25de8b4924fe07a75fbdb12ac8752429c531a73c45
|
7
|
+
data.tar.gz: 3e44c3234b916381053aa0e60eff2bba3c48d468ffd24cf69c5f3b80afcc4a78e38cdd4865842f714fe6f7412deb7796791fd3e69e03259aa503e266ee3da344
|
data/.github/workflows/test.yml
CHANGED
data/changelog.md
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# chartmogul-ruby Change Log
|
2
2
|
|
3
|
+
## Version 3.2.0 - June 14 2023
|
4
|
+
- Adds support for Faraday 2.7
|
5
|
+
- Removes support for Ruby 2.3, 2.4, and 2.5
|
6
|
+
|
7
|
+
## Version 3.1.0 - Mar 30 2023
|
8
|
+
- Adds support for Contacts (https://dev.chartmogul.com/reference/contacts)
|
9
|
+
|
3
10
|
## Version 3.0.2 - 22 Jun 2022
|
4
11
|
- Adds percentage change support
|
5
12
|
|
data/chartmogul-ruby.gemspec
CHANGED
@@ -27,7 +27,8 @@ Gem::Specification.new do |spec|
|
|
27
27
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
28
28
|
spec.require_paths = ['lib']
|
29
29
|
|
30
|
-
spec.add_dependency 'faraday', '~>
|
30
|
+
spec.add_dependency 'faraday', '~> 2.7'
|
31
|
+
spec.add_dependency 'faraday-retry', '~> 2.2'
|
31
32
|
|
32
33
|
spec.add_development_dependency 'bundler', '~> 2'
|
33
34
|
spec.add_development_dependency 'pry', '~> 0.12.2'
|
@@ -0,0 +1,134 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.chartmogul.com/v1/data_sources
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"name":"Customer Test Data Source"}'
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 201
|
19
|
+
message: Created
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 03:41:54 GMT
|
27
|
+
content-length:
|
28
|
+
- '163'
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: '{"uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","name":"Customer
|
34
|
+
Test Data Source","system":"Import API","created_at":"2023-03-10T03:41:54.419Z","status":"idle"}'
|
35
|
+
http_version:
|
36
|
+
recorded_at: Fri, 10 Mar 2023 03:41:54 GMT
|
37
|
+
- request:
|
38
|
+
method: post
|
39
|
+
uri: https://api.chartmogul.com/v1/customers
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"external_id":"X1234","name":"Test Customer","email":"test@example.com","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba"}'
|
43
|
+
headers:
|
44
|
+
User-Agent:
|
45
|
+
- chartmogul-ruby/3.0.2
|
46
|
+
Content-Type:
|
47
|
+
- application/json
|
48
|
+
Authorization:
|
49
|
+
- Basic hidden
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 201
|
53
|
+
message: Created
|
54
|
+
headers:
|
55
|
+
access-control-allow-credentials:
|
56
|
+
- 'true'
|
57
|
+
content-type:
|
58
|
+
- application/json
|
59
|
+
date:
|
60
|
+
- Fri, 10 Mar 2023 03:41:55 GMT
|
61
|
+
content-length:
|
62
|
+
- '785'
|
63
|
+
connection:
|
64
|
+
- keep-alive
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"id":102680322,"uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","external_id":"X1234","name":"Test
|
68
|
+
Customer","email":"test@example.com","status":"New Lead","customer-since":null,"attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","data_source_uuids":["ds_80251880-bef5-11ed-a88b-db28feaa7eba"],"external_ids":["X1234"],"company":"","country":null,"state":null,"city":"","zip":null,"lead_created_at":null,"free_trial_started_at":null,"address":{"country":null,"state":null,"city":"","address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/102680322-Test_Customer","billing-system-type":"Import
|
69
|
+
API","currency":"USD","currency-sign":"$","owner":null}'
|
70
|
+
http_version:
|
71
|
+
recorded_at: Fri, 10 Mar 2023 03:41:56 GMT
|
72
|
+
- request:
|
73
|
+
method: post
|
74
|
+
uri: https://api.chartmogul.com/v1/contacts
|
75
|
+
body:
|
76
|
+
encoding: UTF-8
|
77
|
+
string: '{"email":"test@example.com"}'
|
78
|
+
headers:
|
79
|
+
User-Agent:
|
80
|
+
- chartmogul-ruby/3.0.2
|
81
|
+
Content-Type:
|
82
|
+
- application/json
|
83
|
+
Authorization:
|
84
|
+
- Basic hidden
|
85
|
+
response:
|
86
|
+
status:
|
87
|
+
code: 201
|
88
|
+
message: Created
|
89
|
+
headers:
|
90
|
+
content-type:
|
91
|
+
- application/json
|
92
|
+
date:
|
93
|
+
- Fri, 10 Mar 2023 03:41:57 GMT
|
94
|
+
content-length:
|
95
|
+
- '393'
|
96
|
+
connection:
|
97
|
+
- keep-alive
|
98
|
+
body:
|
99
|
+
encoding: UTF-8
|
100
|
+
string: '{"uuid":"con_2f7b28ba-bef6-11ed-941f-075fbe6af258","customer_uuid":"cus_00b714f0-9e33-11ed-a815-77795aac7785","customer_external_id":"scus_b9373adf50d6ab86e96653b4443efb78","data_source_uuid":"ds_87832fac-ab61-11ec-a8d8-6fb18044a151","position":23,"first_name":null,"last_name":null,"title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}'
|
101
|
+
http_version:
|
102
|
+
recorded_at: Fri, 10 Mar 2023 03:41:57 GMT
|
103
|
+
- request:
|
104
|
+
method: get
|
105
|
+
uri: https://api.chartmogul.com/v1/contacts/con_2f7b28ba-bef6-11ed-941f-075fbe6af258
|
106
|
+
body:
|
107
|
+
encoding: UTF-8
|
108
|
+
string: ''
|
109
|
+
headers:
|
110
|
+
User-Agent:
|
111
|
+
- chartmogul-ruby/3.0.2
|
112
|
+
Content-Type:
|
113
|
+
- application/json
|
114
|
+
Authorization:
|
115
|
+
- Basic hidden
|
116
|
+
response:
|
117
|
+
status:
|
118
|
+
code: 201
|
119
|
+
message: Created
|
120
|
+
headers:
|
121
|
+
content-type:
|
122
|
+
- application/json
|
123
|
+
date:
|
124
|
+
- Fri, 10 Mar 2023 03:41:57 GMT
|
125
|
+
content-length:
|
126
|
+
- '505'
|
127
|
+
connection:
|
128
|
+
- keep-alive
|
129
|
+
body:
|
130
|
+
encoding: UTF-8
|
131
|
+
string: '{"uuid":"con_16470f98-bef7-11ed-9208-7b08a40f3049","customer_uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","customer_external_id":"123","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":1,"first_name":null,"last_name":null,"title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}'
|
132
|
+
http_version:
|
133
|
+
recorded_at: Fri, 10 Mar 2023 03:41:57 GMT
|
134
|
+
recorded_with: VCR 5.1.0
|
data/fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/destroys_contact_correctly.yml
ADDED
@@ -0,0 +1,99 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/contacts/con_e2894d28-9189-11ed-8100-ffadd676801d
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 09:30:33 GMT
|
27
|
+
content-length:
|
28
|
+
- '436'
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: '{"uuid":"con_e2894d28-9189-11ed-8100-ffadd676801d","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":9,"first_name":"Foo","last_name":"Bar","title":"CTO","email":"test2@example.com","phone":"+9876543210","linked_in":"https://linkedin.com/about","twitter":"https://twitter.com/about","notes":null,"custom":{"Toggle":true}}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 10 Mar 2023 09:30:33 GMT
|
36
|
+
- request:
|
37
|
+
method: delete
|
38
|
+
uri: https://api.chartmogul.com/v1/contacts/con_e2894d28-9189-11ed-8100-ffadd676801d
|
39
|
+
body:
|
40
|
+
encoding: US-ASCII
|
41
|
+
string: ''
|
42
|
+
headers:
|
43
|
+
User-Agent:
|
44
|
+
- chartmogul-ruby/3.0.2
|
45
|
+
Authorization:
|
46
|
+
- Basic hidden
|
47
|
+
response:
|
48
|
+
status:
|
49
|
+
code: 200
|
50
|
+
message: OK
|
51
|
+
headers:
|
52
|
+
access-control-allow-credentials:
|
53
|
+
- 'true'
|
54
|
+
content-type:
|
55
|
+
- application/json
|
56
|
+
date:
|
57
|
+
- Fri, 10 Mar 2023 09:30:34 GMT
|
58
|
+
content-length:
|
59
|
+
- '2'
|
60
|
+
connection:
|
61
|
+
- keep-alive
|
62
|
+
body:
|
63
|
+
encoding: UTF-8
|
64
|
+
string: "{}"
|
65
|
+
http_version:
|
66
|
+
recorded_at: Fri, 10 Mar 2023 09:30:34 GMT
|
67
|
+
- request:
|
68
|
+
method: get
|
69
|
+
uri: https://api.chartmogul.com/v1/contacts/con_e2894d28-9189-11ed-8100-ffadd676801d
|
70
|
+
body:
|
71
|
+
encoding: US-ASCII
|
72
|
+
string: ''
|
73
|
+
headers:
|
74
|
+
User-Agent:
|
75
|
+
- chartmogul-ruby/3.0.2
|
76
|
+
Content-Type:
|
77
|
+
- application/json
|
78
|
+
Authorization:
|
79
|
+
- Basic hidden
|
80
|
+
response:
|
81
|
+
status:
|
82
|
+
code: 404
|
83
|
+
message: Not Found
|
84
|
+
headers:
|
85
|
+
content-type:
|
86
|
+
- application/json
|
87
|
+
date:
|
88
|
+
- Fri, 10 Mar 2023 09:30:35 GMT
|
89
|
+
content-length:
|
90
|
+
- '111'
|
91
|
+
connection:
|
92
|
+
- keep-alive
|
93
|
+
body:
|
94
|
+
encoding: UTF-8
|
95
|
+
string: '{"code":404,"message":"Contact \"7c4c3152-9192-11ed-b18e-efa6b954f7e6\"
|
96
|
+
does not exist","param":"contact_uuid"}'
|
97
|
+
http_version:
|
98
|
+
recorded_at: Fri, 10 Mar 2023 09:30:35 GMT
|
99
|
+
recorded_with: VCR 5.1.0
|
@@ -0,0 +1,105 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/contacts/con_f4ef7c64-bf27-11ed-92ad-a7d034bf3085
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 10:03:12 GMT
|
27
|
+
content-length:
|
28
|
+
- '390'
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: '{"uuid":"con_f4ef7c64-bf27-11ed-92ad-a7d034bf3085","customer_uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","customer_external_id":"X1234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":1,"first_name":"Merged
|
34
|
+
1 First","last_name":"Merged 1 Last","title":"","email":"","phone":"","linked_in":"https://linkedin.com/merged1","twitter":"","notes":"Hello","custom":{}}'
|
35
|
+
http_version:
|
36
|
+
recorded_at: Fri, 10 Mar 2023 10:03:12 GMT
|
37
|
+
- request:
|
38
|
+
method: get
|
39
|
+
uri: https://api.chartmogul.com/v1/contacts/con_33dd5606-bf2a-11ed-a7d0-17036209bd22
|
40
|
+
body:
|
41
|
+
encoding: US-ASCII
|
42
|
+
string: ''
|
43
|
+
headers:
|
44
|
+
User-Agent:
|
45
|
+
- chartmogul-ruby/3.0.2
|
46
|
+
Content-Type:
|
47
|
+
- application/json
|
48
|
+
Authorization:
|
49
|
+
- Basic hidden
|
50
|
+
response:
|
51
|
+
status:
|
52
|
+
code: 200
|
53
|
+
message: OK
|
54
|
+
headers:
|
55
|
+
access-control-allow-credentials:
|
56
|
+
- 'true'
|
57
|
+
content-type:
|
58
|
+
- application/json
|
59
|
+
date:
|
60
|
+
- Fri, 10 Mar 2023 10:03:14 GMT
|
61
|
+
content-length:
|
62
|
+
- '420'
|
63
|
+
connection:
|
64
|
+
- keep-alive
|
65
|
+
body:
|
66
|
+
encoding: UTF-8
|
67
|
+
string: '{"uuid":"con_33dd5606-bf2a-11ed-a7d0-17036209bd22","customer_uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","customer_external_id":"X1234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":4,"first_name":"Merged
|
68
|
+
2 First","last_name":"Merged 2 Last","title":"CTO","email":"test6@example.com","phone":"123435412","linked_in":null,"twitter":"https://twitter.com/merged2","notes":"World","custom":{}}'
|
69
|
+
http_version:
|
70
|
+
recorded_at: Fri, 10 Mar 2023 10:03:14 GMT
|
71
|
+
- request:
|
72
|
+
method: post
|
73
|
+
uri: https://api.chartmogul.com/v1/contacts/con_f4ef7c64-bf27-11ed-92ad-a7d034bf3085/merge/con_33dd5606-bf2a-11ed-a7d0-17036209bd22
|
74
|
+
body:
|
75
|
+
encoding: UTF-8
|
76
|
+
string: "{}"
|
77
|
+
headers:
|
78
|
+
User-Agent:
|
79
|
+
- chartmogul-ruby/3.0.2
|
80
|
+
Content-Type:
|
81
|
+
- application/json
|
82
|
+
Authorization:
|
83
|
+
- Basic hidden
|
84
|
+
response:
|
85
|
+
status:
|
86
|
+
code: 200
|
87
|
+
message: OK
|
88
|
+
headers:
|
89
|
+
access-control-allow-credentials:
|
90
|
+
- 'true'
|
91
|
+
content-type:
|
92
|
+
- application/json
|
93
|
+
date:
|
94
|
+
- Fri, 10 Mar 2023 10:03:15 GMT
|
95
|
+
content-length:
|
96
|
+
- '414'
|
97
|
+
connection:
|
98
|
+
- keep-alive
|
99
|
+
body:
|
100
|
+
encoding: UTF-8
|
101
|
+
string: '{"uuid":"con_f4ef7c64-bf27-11ed-92ad-a7d034bf3085","customer_uuid":null,"customer_external_id":"X1234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":1,"first_name":"Merged
|
102
|
+
1 First","last_name":"Merged 1 Last","title":"CTO","email":"test6@example.com","phone":"123435412","linked_in":"https://linkedin.com/merged1","twitter":"https://twitter.com/merged2","notes":"Hello World","custom":{}}'
|
103
|
+
http_version:
|
104
|
+
recorded_at: Fri, 10 Mar 2023 10:03:15 GMT
|
105
|
+
recorded_with: VCR 5.1.0
|
@@ -0,0 +1,133 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/contacts
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 08:51:16 GMT
|
27
|
+
vary:
|
28
|
+
- Accept-Encoding
|
29
|
+
transfer-encoding:
|
30
|
+
- chunked
|
31
|
+
connection:
|
32
|
+
- keep-alive
|
33
|
+
body:
|
34
|
+
encoding: ASCII-8BIT
|
35
|
+
string: '{
|
36
|
+
"entries":[
|
37
|
+
{"uuid":"con_1922c172-9174-11ed-b655-47c5fb422d6c","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":1,"first_name":"contact1","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
38
|
+
{"uuid":"con_c12a64ea-9180-11ed-b6ec-9752d090f315","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":2,"first_name":"contact2","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
39
|
+
{"uuid":"con_1fe21a32-9181-11ed-b536-7f856d6a5b2d","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":3,"first_name":"contact3","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
40
|
+
{"uuid":"con_e2894d28-9189-11ed-8100-ffadd676801d","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":4,"first_name":"contact4","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
41
|
+
{"uuid":"con_2019ea66-9190-11ed-bb5a-779d25c759d0","customer_uuid":"cus_189e19d1-9893-4afe-b035-42e23c4799a6","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":5,"first_name":"contact5","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}
|
42
|
+
],
|
43
|
+
"cursor":"MjAyMy0wMS0xMVQwNzoyNToyOS4wMDI5MzIwMDBaJmNvbl8xZmUyMWEzMi05MTgxLTExZWQtYjUzNi03Zjg1NmQ2YTViMmQ=",
|
44
|
+
"has_more":false
|
45
|
+
}'
|
46
|
+
http_version:
|
47
|
+
recorded_at: Fri, 10 Mar 2023 08:51:16 GMT
|
48
|
+
- request:
|
49
|
+
method: get
|
50
|
+
uri: https://api.chartmogul.com/v1/contacts?per_page=3
|
51
|
+
body:
|
52
|
+
encoding: US-ASCII
|
53
|
+
string: ''
|
54
|
+
headers:
|
55
|
+
User-Agent:
|
56
|
+
- chartmogul-ruby/3.0.2
|
57
|
+
Content-Type:
|
58
|
+
- application/json
|
59
|
+
Authorization:
|
60
|
+
- Basic hidden
|
61
|
+
response:
|
62
|
+
status:
|
63
|
+
code: 200
|
64
|
+
message: OK
|
65
|
+
headers:
|
66
|
+
access-control-allow-credentials:
|
67
|
+
- 'true'
|
68
|
+
content-type:
|
69
|
+
- application/json
|
70
|
+
date:
|
71
|
+
- Fri, 10 Mar 2023 08:51:17 GMT
|
72
|
+
vary:
|
73
|
+
- Accept-Encoding
|
74
|
+
content-length:
|
75
|
+
- '570'
|
76
|
+
connection:
|
77
|
+
- keep-alive
|
78
|
+
body:
|
79
|
+
encoding: ASCII-8BIT
|
80
|
+
string: '{
|
81
|
+
"entries":[
|
82
|
+
{"uuid":"con_1922c172-9174-11ed-b655-47c5fb422d6c","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":1,"first_name":"contact1","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
83
|
+
{"uuid":"con_c12a64ea-9180-11ed-b6ec-9752d090f315","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":2,"first_name":"contact2","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
84
|
+
{"uuid":"con_1fe21a32-9181-11ed-b536-7f856d6a5b2d","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":3,"first_name":"contact3","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}
|
85
|
+
],
|
86
|
+
"cursor":"MjAyMy0wMS0xMVQwNzoyNToyOS4wMDI5MzIwMDBaJmNvbl8xZmUyMWEzMi05MTgxLTExZWQtYjUzNi03Zjg1NmQ2YTViMmQ=",
|
87
|
+
"has_more":true
|
88
|
+
}'
|
89
|
+
http_version:
|
90
|
+
recorded_at: Fri, 10 Mar 2023 08:51:18 GMT
|
91
|
+
- request:
|
92
|
+
method: get
|
93
|
+
uri: https://api.chartmogul.com/v1/contacts?cursor=MjAyMy0wMS0xMVQwNzoyNToyOS4wMDI5MzIwMDBaJmNvbl8xZmUyMWEzMi05MTgxLTExZWQtYjUzNi03Zjg1NmQ2YTViMmQ%3D&per_page=3
|
94
|
+
body:
|
95
|
+
encoding: US-ASCII
|
96
|
+
string: ''
|
97
|
+
headers:
|
98
|
+
User-Agent:
|
99
|
+
- chartmogul-ruby/3.0.2
|
100
|
+
Content-Type:
|
101
|
+
- application/json
|
102
|
+
Authorization:
|
103
|
+
- Basic hidden
|
104
|
+
response:
|
105
|
+
status:
|
106
|
+
code: 200
|
107
|
+
message: OK
|
108
|
+
headers:
|
109
|
+
access-control-allow-credentials:
|
110
|
+
- 'true'
|
111
|
+
content-type:
|
112
|
+
- application/json
|
113
|
+
date:
|
114
|
+
- Fri, 10 Mar 2023 08:51:19 GMT
|
115
|
+
vary:
|
116
|
+
- Accept-Encoding
|
117
|
+
content-length:
|
118
|
+
- '532'
|
119
|
+
connection:
|
120
|
+
- keep-alive
|
121
|
+
body:
|
122
|
+
encoding: ASCII-8BIT
|
123
|
+
string: '{
|
124
|
+
"entries":[
|
125
|
+
{"uuid":"con_e2894d28-9189-11ed-8100-ffadd676801d","customer_uuid":"cus_19580b15-1ab7-40ec-bdb9-638b81354b9e","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":4,"first_name":"contact4","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}},
|
126
|
+
{"uuid":"con_2019ea66-9190-11ed-bb5a-779d25c759d0","customer_uuid":"cus_189e19d1-9893-4afe-b035-42e23c4799a6","customer_external_id":"scus_021","data_source_uuid":"ds_2b98cb2c-5bf0-11ec-a5d0-07b36dac065d","position":5,"first_name":"contact5","last_name":"contact","title":null,"email":"test@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}
|
127
|
+
],
|
128
|
+
"cursor":"MjAyMy0wMS0xMVQwOToyOTo0NS40ODYzNTkwMDBaJmNvbl83YzRjMzE1Mi05MTkyLTExZWQtYjE4ZS1lZmE2Yjk1NGY3ZTY=",
|
129
|
+
"has_more":false
|
130
|
+
}'
|
131
|
+
http_version:
|
132
|
+
recorded_at: Fri, 10 Mar 2023 08:51:19 GMT
|
133
|
+
recorded_with: VCR 5.1.0
|
@@ -0,0 +1,102 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/contacts/con_8305e66c-bf2f-11ed-a4cb-db537410c51b
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 10:38:00 GMT
|
27
|
+
content-length:
|
28
|
+
- '346'
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: '{"uuid":"con_8305e66c-bf2f-11ed-a4cb-db537410c51b","customer_uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","customer_external_id":"X1234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":6,"first_name":null,"last_name":null,"title":null,"email":null,"phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}'
|
34
|
+
http_version:
|
35
|
+
recorded_at: Fri, 10 Mar 2023 10:38:00 GMT
|
36
|
+
- request:
|
37
|
+
method: patch
|
38
|
+
uri: https://api.chartmogul.com/v1/contacts/con_8305e66c-bf2f-11ed-a4cb-db537410c51b
|
39
|
+
body:
|
40
|
+
encoding: UTF-8
|
41
|
+
string: '{"customer_external_id":"X1234","position":9,"first_name":"Foo","last_name":"Bar","title":"CTO","email":"test2@example.com","phone":"+9876543210","linked_in":"https://linkedin.com/about","twitter":"https://twitter.com/about","custom":[{"key":"Toggle","value":false}]}'
|
42
|
+
headers:
|
43
|
+
User-Agent:
|
44
|
+
- chartmogul-ruby/3.0.2
|
45
|
+
Content-Type:
|
46
|
+
- application/json
|
47
|
+
Authorization:
|
48
|
+
- Basic hidden
|
49
|
+
response:
|
50
|
+
status:
|
51
|
+
code: 200
|
52
|
+
message: OK
|
53
|
+
headers:
|
54
|
+
access-control-allow-credentials:
|
55
|
+
- 'true'
|
56
|
+
content-type:
|
57
|
+
- application/json
|
58
|
+
date:
|
59
|
+
- Fri, 10 Mar 2023 10:38:01 GMT
|
60
|
+
content-length:
|
61
|
+
- '434'
|
62
|
+
connection:
|
63
|
+
- keep-alive
|
64
|
+
body:
|
65
|
+
encoding: UTF-8
|
66
|
+
string: '{"uuid":"con_8305e66c-bf2f-11ed-a4cb-db537410c51b","customer_uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","customer_external_id":"X1234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":9,"first_name":"Foo","last_name":"Bar","title":"CTO","email":"test2@example.com","phone":"+9876543210","linked_in":"https://linkedin.com/about","twitter":"https://twitter.com/about","notes":null,"custom":{"Toggle":false}}'
|
67
|
+
http_version:
|
68
|
+
recorded_at: Fri, 10 Mar 2023 10:38:01 GMT
|
69
|
+
- request:
|
70
|
+
method: get
|
71
|
+
uri: https://api.chartmogul.com/v1/contacts/con_8305e66c-bf2f-11ed-a4cb-db537410c51b
|
72
|
+
body:
|
73
|
+
encoding: US-ASCII
|
74
|
+
string: ''
|
75
|
+
headers:
|
76
|
+
User-Agent:
|
77
|
+
- chartmogul-ruby/3.0.2
|
78
|
+
Content-Type:
|
79
|
+
- application/json
|
80
|
+
Authorization:
|
81
|
+
- Basic hidden
|
82
|
+
response:
|
83
|
+
status:
|
84
|
+
code: 200
|
85
|
+
message: OK
|
86
|
+
headers:
|
87
|
+
access-control-allow-credentials:
|
88
|
+
- 'true'
|
89
|
+
content-type:
|
90
|
+
- application/json
|
91
|
+
date:
|
92
|
+
- Fri, 10 Mar 2023 10:38:03 GMT
|
93
|
+
content-length:
|
94
|
+
- '434'
|
95
|
+
connection:
|
96
|
+
- keep-alive
|
97
|
+
body:
|
98
|
+
encoding: UTF-8
|
99
|
+
string: '{"uuid":"con_8305e66c-bf2f-11ed-a4cb-db537410c51b","customer_uuid":"cus_80ec0c06-bef5-11ed-a88c-974c518fc467","customer_external_id":"X1234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":9,"first_name":"Foo","last_name":"Bar","title":"CTO","email":"test2@example.com","phone":"+9876543210","linked_in":"https://linkedin.com/about","twitter":"https://twitter.com/about","notes":null,"custom":{"Toggle":false}}'
|
100
|
+
http_version:
|
101
|
+
recorded_at: Fri, 10 Mar 2023 10:38:03 GMT
|
102
|
+
recorded_with: VCR 5.1.0
|
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/customers/cus_54cde7bc-bf30-11ed-a51a-2325f065834f
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 11:02:57 GMT
|
27
|
+
content-length:
|
28
|
+
- '769'
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: '{"id":102689329,"uuid":"cus_54cde7bc-bf30-11ed-a51a-2325f065834f","external_id":"11234","name":"","email":"","status":"New
|
34
|
+
Lead","customer-since":null,"attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","data_source_uuids":["ds_80251880-bef5-11ed-a88b-db28feaa7eba"],"external_ids":["11234"],"company":"Test
|
35
|
+
customer","country":null,"state":null,"city":"","zip":null,"lead_created_at":null,"free_trial_started_at":null,"address":{"country":null,"state":null,"city":"","address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/102689329-Test_customer","billing-system-type":"Import
|
36
|
+
API","currency":"USD","currency-sign":"$","owner":null}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Fri, 10 Mar 2023 11:02:57 GMT
|
39
|
+
- request:
|
40
|
+
method: post
|
41
|
+
uri: https://api.chartmogul.com/v1/contacts
|
42
|
+
body:
|
43
|
+
encoding: UTF-8
|
44
|
+
string: '{"customer_uuid":"cus_54cde7bc-bf30-11ed-a51a-2325f065834f","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","email":"new_contact@example.com"}'
|
45
|
+
headers:
|
46
|
+
User-Agent:
|
47
|
+
- chartmogul-ruby/3.0.2
|
48
|
+
Content-Type:
|
49
|
+
- application/json
|
50
|
+
Authorization:
|
51
|
+
- Basic hidden
|
52
|
+
response:
|
53
|
+
status:
|
54
|
+
code: 201
|
55
|
+
message: Created
|
56
|
+
headers:
|
57
|
+
access-control-allow-credentials:
|
58
|
+
- 'true'
|
59
|
+
content-type:
|
60
|
+
- application/json
|
61
|
+
date:
|
62
|
+
- Fri, 10 Mar 2023 11:02:58 GMT
|
63
|
+
content-length:
|
64
|
+
- '367'
|
65
|
+
connection:
|
66
|
+
- keep-alive
|
67
|
+
body:
|
68
|
+
encoding: UTF-8
|
69
|
+
string: '{"uuid":"con_1e366712-bf33-11ed-84e6-9bba0516ad5f","customer_uuid":"cus_54cde7bc-bf30-11ed-a51a-2325f065834f","customer_external_id":"11234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":2,"first_name":null,"last_name":null,"title":null,"email":"new_contact@example.com","phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}'
|
70
|
+
http_version:
|
71
|
+
recorded_at: Fri, 10 Mar 2023 11:02:59 GMT
|
72
|
+
recorded_with: VCR 5.1.0
|
@@ -0,0 +1,72 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/customers/cus_54cde7bc-bf30-11ed-a51a-2325f065834f
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- chartmogul-ruby/3.0.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
access-control-allow-credentials:
|
22
|
+
- 'true'
|
23
|
+
content-type:
|
24
|
+
- application/json
|
25
|
+
date:
|
26
|
+
- Fri, 10 Mar 2023 10:43:38 GMT
|
27
|
+
content-length:
|
28
|
+
- '769'
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
body:
|
32
|
+
encoding: UTF-8
|
33
|
+
string: '{"id":102689329,"uuid":"cus_54cde7bc-bf30-11ed-a51a-2325f065834f","external_id":"11234","name":"","email":"","status":"New
|
34
|
+
Lead","customer-since":null,"attributes":{"custom":{},"clearbit":{},"stripe":{},"tags":[]},"data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","data_source_uuids":["ds_80251880-bef5-11ed-a88b-db28feaa7eba"],"external_ids":["11234"],"company":"Test
|
35
|
+
customer","country":null,"state":null,"city":"","zip":null,"lead_created_at":null,"free_trial_started_at":null,"address":{"country":null,"state":null,"city":"","address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#/customers/102689329-Test_customer","billing-system-type":"Import
|
36
|
+
API","currency":"USD","currency-sign":"$","owner":null}'
|
37
|
+
http_version:
|
38
|
+
recorded_at: Fri, 10 Mar 2023 10:43:38 GMT
|
39
|
+
- request:
|
40
|
+
method: get
|
41
|
+
uri: https://api.chartmogul.com/v1/contacts?customer_uuid=cus_54cde7bc-bf30-11ed-a51a-2325f065834f
|
42
|
+
body:
|
43
|
+
encoding: US-ASCII
|
44
|
+
string: ''
|
45
|
+
headers:
|
46
|
+
User-Agent:
|
47
|
+
- chartmogul-ruby/3.0.2
|
48
|
+
Content-Type:
|
49
|
+
- application/json
|
50
|
+
Authorization:
|
51
|
+
- Basic hidden
|
52
|
+
response:
|
53
|
+
status:
|
54
|
+
code: 200
|
55
|
+
message: OK
|
56
|
+
headers:
|
57
|
+
access-control-allow-credentials:
|
58
|
+
- 'true'
|
59
|
+
content-type:
|
60
|
+
- application/json
|
61
|
+
date:
|
62
|
+
- Fri, 10 Mar 2023 10:43:40 GMT
|
63
|
+
content-length:
|
64
|
+
- '490'
|
65
|
+
connection:
|
66
|
+
- keep-alive
|
67
|
+
body:
|
68
|
+
encoding: UTF-8
|
69
|
+
string: '{"entries":[{"uuid":"con_6342518e-bf30-11ed-8542-5fe570cf19d7","customer_uuid":"cus_54cde7bc-bf30-11ed-a51a-2325f065834f","customer_external_id":"11234","data_source_uuid":"ds_80251880-bef5-11ed-a88b-db28feaa7eba","position":1,"first_name":"Test","last_name":"Again","title":null,"email":null,"phone":null,"linked_in":null,"twitter":null,"notes":null,"custom":{}}],"cursor":"MjAyMy0wMy0xMFQxMDo0MzoyNi4yOTE4ODgwMDBaJmNvbl82MzQyNTE4ZS1iZjMwLTExZWQtODU0Mi01ZmU1NzBjZjE5ZDc=","has_more":false}'
|
70
|
+
http_version:
|
71
|
+
recorded_at: Fri, 10 Mar 2023 10:43:40 GMT
|
72
|
+
recorded_with: VCR 5.1.0
|
@@ -90,8 +90,8 @@ module ChartMogul
|
|
90
90
|
|
91
91
|
def self.build_connection
|
92
92
|
Faraday.new(url: ChartMogul.api_base, headers: { 'User-Agent' => "chartmogul-ruby/#{ChartMogul::VERSION}" }) do |faraday|
|
93
|
-
faraday.use Faraday::Request::BasicAuthentication, ChartMogul.api_key, ''
|
94
93
|
faraday.use Faraday::Response::RaiseError
|
94
|
+
faraday.request :authorization, :basic, ChartMogul.api_key, ''
|
95
95
|
faraday.request :retry, max: ChartMogul.max_retries, retry_statuses: RETRY_STATUSES,
|
96
96
|
max_interval: MAX_INTERVAL, backoff_factor: BACKOFF_FACTOR,
|
97
97
|
interval_randomness: INTERVAL_RANDOMNESS, interval: INTERVAL, exceptions: RETRY_EXCEPTIONS
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ChartMogul
|
4
|
+
class Contact < APIResource
|
5
|
+
set_resource_name 'Contact'
|
6
|
+
set_resource_path '/v1/contacts'
|
7
|
+
set_immutable_keys([:custom])
|
8
|
+
|
9
|
+
readonly_attr :uuid
|
10
|
+
|
11
|
+
writeable_attr :customer_uuid
|
12
|
+
writeable_attr :data_source_uuid
|
13
|
+
writeable_attr :customer_external_id
|
14
|
+
writeable_attr :position
|
15
|
+
writeable_attr :first_name
|
16
|
+
writeable_attr :last_name
|
17
|
+
writeable_attr :title
|
18
|
+
writeable_attr :email
|
19
|
+
writeable_attr :phone
|
20
|
+
writeable_attr :linked_in
|
21
|
+
writeable_attr :twitter
|
22
|
+
writeable_attr :notes
|
23
|
+
writeable_attr :custom
|
24
|
+
|
25
|
+
include API::Actions::Create
|
26
|
+
include API::Actions::Custom
|
27
|
+
include API::Actions::Destroy
|
28
|
+
include API::Actions::Retrieve
|
29
|
+
include API::Actions::Update
|
30
|
+
|
31
|
+
def self.all(options = {})
|
32
|
+
Contacts.all(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.merge!(into_uuid:, from_uuid:)
|
36
|
+
custom!(:post, "/v1/contacts/#{into_uuid}/merge/#{from_uuid}")
|
37
|
+
end
|
38
|
+
|
39
|
+
def serialize_for_write
|
40
|
+
super.tap do |attributes|
|
41
|
+
attributes.clone.each do |attribute_name, attribute_value|
|
42
|
+
if attribute_name == :custom && attribute_value.is_a?(Hash)
|
43
|
+
payload = attribute_value.each_with_object([]) do |custom_value, arr|
|
44
|
+
key, value = custom_value
|
45
|
+
arr << { key: key, value: value }
|
46
|
+
end
|
47
|
+
attributes[:custom] = payload
|
48
|
+
else
|
49
|
+
attributes[attribute_name] = attribute_value
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class Contacts < APIResource
|
57
|
+
set_resource_name 'Contacts'
|
58
|
+
set_resource_path '/v1/contacts'
|
59
|
+
|
60
|
+
include Concerns::Entries
|
61
|
+
include Concerns::PageableWithCursor
|
62
|
+
|
63
|
+
set_entry_class Contact
|
64
|
+
|
65
|
+
def next(options = {})
|
66
|
+
Contacts.all(options.merge(cursor: cursor))
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
data/lib/chartmogul/customer.rb
CHANGED
@@ -65,6 +65,14 @@ module ChartMogul
|
|
65
65
|
@invoices = ChartMogul::CustomerInvoices.new(customer_uuid: uuid, invoices: invoices_array)
|
66
66
|
end
|
67
67
|
|
68
|
+
def contacts(options = {})
|
69
|
+
Contacts.all(options.merge(customer_uuid: uuid))
|
70
|
+
end
|
71
|
+
|
72
|
+
def create_contact(options = {})
|
73
|
+
Contact.create!(options.merge(customer_uuid: uuid))
|
74
|
+
end
|
75
|
+
|
68
76
|
# Enrichment
|
69
77
|
def tags
|
70
78
|
@attributes[:tags]
|
data/lib/chartmogul/version.rb
CHANGED
data/lib/chartmogul.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require 'time'
|
4
4
|
require 'json'
|
5
5
|
require 'faraday'
|
6
|
+
require 'faraday/retry'
|
6
7
|
|
7
8
|
require 'chartmogul/version'
|
8
9
|
|
@@ -47,11 +48,13 @@ require 'chartmogul/concerns/summary_all'
|
|
47
48
|
require 'chartmogul/concerns/pageable'
|
48
49
|
require 'chartmogul/concerns/pageable2'
|
49
50
|
require 'chartmogul/concerns/pageable_with_anchor'
|
51
|
+
require 'chartmogul/concerns/pageable_with_cursor'
|
50
52
|
|
51
53
|
require 'chartmogul/subscription'
|
52
54
|
require 'chartmogul/invoice'
|
53
55
|
require 'chartmogul/customer_invoices'
|
54
56
|
require 'chartmogul/customer'
|
57
|
+
require 'chartmogul/contact'
|
55
58
|
require 'chartmogul/data_source'
|
56
59
|
require 'chartmogul/ping'
|
57
60
|
require 'chartmogul/plan'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chartmogul-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Petr Kopac
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,14 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday-retry
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.2'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.2'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -186,11 +200,18 @@ files:
|
|
186
200
|
- fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_in_a_threaded_environment.yml
|
187
201
|
- fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_when_credentials_are_updated.yml
|
188
202
|
- fixtures/vcr_cassettes/ChartMogul_Account/returns_details_of_current_account.yml
|
203
|
+
- fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/creates_contact_correctly.yml
|
204
|
+
- fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/destroys_contact_correctly.yml
|
205
|
+
- fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/merges_contact_correctly.yml
|
206
|
+
- fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/paginates_correctly.yml
|
207
|
+
- fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/updates_contact_correctly.yml
|
189
208
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_custom_attributes.yml
|
190
209
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_required_tags.yml
|
191
210
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/can_page_through_search_endpoint.yml
|
192
211
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_handles_a_422_response.yml
|
193
212
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_interracts_with_the_API.yml
|
213
|
+
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/creates_a_contact_belonging_to_the_customer_correctly.yml
|
214
|
+
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/lists_the_contacts_belonging_to_the_customer_correctly.yml
|
194
215
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/merges_customers.yml
|
195
216
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_401_if_invalid_credentials.yml
|
196
217
|
- fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_404_if_no_customers_found.yml
|
@@ -287,10 +308,12 @@ files:
|
|
287
308
|
- lib/chartmogul/concerns/pageable.rb
|
288
309
|
- lib/chartmogul/concerns/pageable2.rb
|
289
310
|
- lib/chartmogul/concerns/pageable_with_anchor.rb
|
311
|
+
- lib/chartmogul/concerns/pageable_with_cursor.rb
|
290
312
|
- lib/chartmogul/concerns/summary.rb
|
291
313
|
- lib/chartmogul/concerns/summary_all.rb
|
292
314
|
- lib/chartmogul/config_attributes.rb
|
293
315
|
- lib/chartmogul/configuration.rb
|
316
|
+
- lib/chartmogul/contact.rb
|
294
317
|
- lib/chartmogul/customer.rb
|
295
318
|
- lib/chartmogul/customer_invoices.rb
|
296
319
|
- lib/chartmogul/data_source.rb
|
@@ -360,7 +383,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
360
383
|
- !ruby/object:Gem::Version
|
361
384
|
version: '0'
|
362
385
|
requirements: []
|
363
|
-
rubygems_version: 3.
|
386
|
+
rubygems_version: 3.2.3
|
364
387
|
signing_key:
|
365
388
|
specification_version: 4
|
366
389
|
summary: Chartmogul API Ruby Client
|