chartmogul-ruby 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f66ab5d08210ccfa0d00db3b35a92d63c038db6fd7dd3608b945425705406edf
4
- data.tar.gz: e56d59d45b74eed18d088bb6832d9d6478d16c1c472bf2178d7f0cdc26b30a8d
3
+ metadata.gz: 4dca7992932698b0fc6f915679e1d61fa845dc0e45d5e977c9170fea4b92d2d1
4
+ data.tar.gz: 14a3066c65ce5ff65a25eb8dcb240b08bd69f149ba853eb641cda4f7613079e1
5
5
  SHA512:
6
- metadata.gz: 6fd45ab42d6ffb9cac4a808f734d7be91f670b59c3c71beaa691d6bc41cfcc264adf9b7547bfb898eb595b52d8ed609559af1128ba1c72a72061790fb56f3f5e
7
- data.tar.gz: 5c17e4848789a138ef77879e7335977f524ee5e905f15b714d2d5994a06f75ce7537a16347e551cfaf67bbcf65d2cf505e543f0975dc0513c4c2166307ec751f
6
+ metadata.gz: 4063a1c674456cf0390d04dfda358596cb43151523122f7f2761aa41f4f60c065575ae7b4b2b347c314b406740972fd72fe5f7daabb05ef4f58f7bf2eb7cd38f
7
+ data.tar.gz: 1145e0e48d1923ec593c5e94433e5abebd773dfb0cadb12426c177f13f307994791d7ec0cd7f1a3069a8dfa0d15f899286d81ec5e65887401238fe45b5c9ba46
data/changelog.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # chartmogul-ruby Change Log
2
2
 
3
+ ## Version 3.1.0 - Mar 30 2023
4
+ - Adds support for Contacts (https://dev.chartmogul.com/reference/contacts)
5
+
3
6
  ## Version 3.0.2 - 22 Jun 2022
4
7
  - Adds percentage change support
5
8
 
@@ -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
@@ -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
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ChartMogul
4
+ module Concerns
5
+ module PageableWithCursor
6
+ def self.included(base)
7
+ base.instance_eval do
8
+ readonly_attr :has_more
9
+ readonly_attr :cursor
10
+ end
11
+ end
12
+ end
13
+ end
14
+ end
@@ -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
@@ -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]
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ChartMogul
4
- VERSION = '3.0.2'
4
+ VERSION = '3.1.0'
5
5
  end
data/lib/chartmogul.rb CHANGED
@@ -47,11 +47,13 @@ require 'chartmogul/concerns/summary_all'
47
47
  require 'chartmogul/concerns/pageable'
48
48
  require 'chartmogul/concerns/pageable2'
49
49
  require 'chartmogul/concerns/pageable_with_anchor'
50
+ require 'chartmogul/concerns/pageable_with_cursor'
50
51
 
51
52
  require 'chartmogul/subscription'
52
53
  require 'chartmogul/invoice'
53
54
  require 'chartmogul/customer_invoices'
54
55
  require 'chartmogul/customer'
56
+ require 'chartmogul/contact'
55
57
  require 'chartmogul/data_source'
56
58
  require 'chartmogul/ping'
57
59
  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.2
4
+ version: 3.1.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: 2022-07-15 00:00:00.000000000 Z
11
+ date: 2023-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -186,11 +186,18 @@ files:
186
186
  - fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_in_a_threaded_environment.yml
187
187
  - fixtures/vcr_cassettes/ChartMogul_APIResource/connection/works_when_credentials_are_updated.yml
188
188
  - fixtures/vcr_cassettes/ChartMogul_Account/returns_details_of_current_account.yml
189
+ - fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/creates_contact_correctly.yml
190
+ - fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/destroys_contact_correctly.yml
191
+ - fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/merges_contact_correctly.yml
192
+ - fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/paginates_correctly.yml
193
+ - fixtures/vcr_cassettes/ChartMogul_Contact/API_Interactions/updates_contact_correctly.yml
189
194
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_custom_attributes.yml
190
195
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_required_tags.yml
191
196
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/can_page_through_search_endpoint.yml
192
197
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_handles_a_422_response.yml
193
198
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_interracts_with_the_API.yml
199
+ - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/creates_a_contact_belonging_to_the_customer_correctly.yml
200
+ - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/lists_the_contacts_belonging_to_the_customer_correctly.yml
194
201
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/merges_customers.yml
195
202
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_401_if_invalid_credentials.yml
196
203
  - fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_404_if_no_customers_found.yml
@@ -287,10 +294,12 @@ files:
287
294
  - lib/chartmogul/concerns/pageable.rb
288
295
  - lib/chartmogul/concerns/pageable2.rb
289
296
  - lib/chartmogul/concerns/pageable_with_anchor.rb
297
+ - lib/chartmogul/concerns/pageable_with_cursor.rb
290
298
  - lib/chartmogul/concerns/summary.rb
291
299
  - lib/chartmogul/concerns/summary_all.rb
292
300
  - lib/chartmogul/config_attributes.rb
293
301
  - lib/chartmogul/configuration.rb
302
+ - lib/chartmogul/contact.rb
294
303
  - lib/chartmogul/customer.rb
295
304
  - lib/chartmogul/customer_invoices.rb
296
305
  - lib/chartmogul/data_source.rb