chartmogul-ruby 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/changelog.md +4 -0
- data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/merges_customers.yml +185 -0
- data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/raises_422_for_update_with_invalid_data.yml +86 -0
- data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/updates_customer.yml +139 -0
- data/lib/chartmogul/api/actions/custom.rb +1 -1
- data/lib/chartmogul/enrichment/customer.rb +21 -3
- data/lib/chartmogul/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ac53d485cbc90316aea9203f60009924910ebf75
|
4
|
+
data.tar.gz: dd519a0580ca04fe3062a563ae1438b2b1e1e4b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 93e2005d1b3b1ba51c7144f9aa09212313131f9cd30bab06dd5fa9df743e0cdac9e07d195903e840873fa6b05c63c6903a15b8db98bf97d07726df874f189b9d
|
7
|
+
data.tar.gz: 7f7ef08917f59d0e940c2141b1eda1e1d8b24485660dd0438e579c0f5d2e6680525faa6a8fffadaa4667f7e504e2d20109d8c73ddf5412088b3e06065d557bd1
|
data/changelog.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# chartmogul-ruby Change Log
|
2
2
|
|
3
|
+
## Version 0.1.4 - 10 November 2016
|
4
|
+
- Add support for merging customers
|
5
|
+
- Add support for updating customers
|
6
|
+
|
3
7
|
## Version 0.1.3 - 8 November 2016
|
4
8
|
- Add support for lead_created_at and free_trial_started_at fields to work with Leads and Trials charts
|
5
9
|
|
data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/merges_customers.yml
ADDED
@@ -0,0 +1,185 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/customers/cus_35da5436-a730-11e6-a5a0-d32f2a781b50
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
server:
|
22
|
+
- nginx/1.10.1
|
23
|
+
date:
|
24
|
+
- Thu, 10 Nov 2016 10:32:07 GMT
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
content-length:
|
28
|
+
- '496'
|
29
|
+
connection:
|
30
|
+
- close
|
31
|
+
status:
|
32
|
+
- 200 OK
|
33
|
+
access-control-allow-credentials:
|
34
|
+
- 'true'
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"id":6474477,"uuid":"cus_35da5436-a730-11e6-a5a0-d32f2a781b50","external_id":"8b5b6aff-ca49-4079-9273-1268a64ac462","name":"from@merge.com","email":"from@merge.com","status":"Lead","customer-since":null,"attributes":{"tags":[]},"address":{"country":"Comoros","state":null,"city":null,"address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/6474477-from_merge_com","billing-system-type":"Manual","currency":"UGX","currency-sign":null}'
|
38
|
+
http_version:
|
39
|
+
recorded_at: Thu, 10 Nov 2016 10:32:07 GMT
|
40
|
+
- request:
|
41
|
+
method: get
|
42
|
+
uri: https://api.chartmogul.com/v1/customers/cus_fc5451ee-a72f-11e6-9019-3b1a0ecf3c73
|
43
|
+
body:
|
44
|
+
encoding: UTF-8
|
45
|
+
string: "{}"
|
46
|
+
headers:
|
47
|
+
User-Agent:
|
48
|
+
- Faraday v0.9.2
|
49
|
+
Content-Type:
|
50
|
+
- application/json
|
51
|
+
Authorization:
|
52
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
53
|
+
response:
|
54
|
+
status:
|
55
|
+
code: 200
|
56
|
+
message:
|
57
|
+
headers:
|
58
|
+
server:
|
59
|
+
- nginx/1.10.1
|
60
|
+
date:
|
61
|
+
- Thu, 10 Nov 2016 10:32:07 GMT
|
62
|
+
content-type:
|
63
|
+
- application/json
|
64
|
+
content-length:
|
65
|
+
- '495'
|
66
|
+
connection:
|
67
|
+
- close
|
68
|
+
status:
|
69
|
+
- 200 OK
|
70
|
+
access-control-allow-credentials:
|
71
|
+
- 'true'
|
72
|
+
body:
|
73
|
+
encoding: UTF-8
|
74
|
+
string: '{"id":6474475,"uuid":"cus_fc5451ee-a72f-11e6-9019-3b1a0ecf3c73","external_id":"7ea39c1b-2286-4cb7-b1c8-9a63e8358875","name":"into@merge.com","email":"into@merge.com","status":"Lead","customer-since":null,"attributes":{"tags":[]},"address":{"country":"Angola","state":null,"city":null,"address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/6474475-into_merge_com","billing-system-type":"Manual","currency":"UGX","currency-sign":null}'
|
75
|
+
http_version:
|
76
|
+
recorded_at: Thu, 10 Nov 2016 10:32:07 GMT
|
77
|
+
- request:
|
78
|
+
method: post
|
79
|
+
uri: https://api.chartmogul.com/v1/customers/merges
|
80
|
+
body:
|
81
|
+
encoding: UTF-8
|
82
|
+
string: '{"from":{"customer_uuid":"cus_35da5436-a730-11e6-a5a0-d32f2a781b50"},"into":{"customer_uuid":"cus_fc5451ee-a72f-11e6-9019-3b1a0ecf3c73"}}'
|
83
|
+
headers:
|
84
|
+
User-Agent:
|
85
|
+
- Faraday v0.9.2
|
86
|
+
Content-Type:
|
87
|
+
- application/json
|
88
|
+
Authorization:
|
89
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
90
|
+
response:
|
91
|
+
status:
|
92
|
+
code: 202
|
93
|
+
message:
|
94
|
+
headers:
|
95
|
+
server:
|
96
|
+
- nginx/1.10.1
|
97
|
+
date:
|
98
|
+
- Thu, 10 Nov 2016 10:32:07 GMT
|
99
|
+
content-type:
|
100
|
+
- application/json
|
101
|
+
content-length:
|
102
|
+
- '2'
|
103
|
+
connection:
|
104
|
+
- close
|
105
|
+
status:
|
106
|
+
- 202 Accepted
|
107
|
+
body:
|
108
|
+
encoding: UTF-8
|
109
|
+
string: "{}"
|
110
|
+
http_version:
|
111
|
+
recorded_at: Thu, 10 Nov 2016 10:32:07 GMT
|
112
|
+
- request:
|
113
|
+
method: get
|
114
|
+
uri: https://api.chartmogul.com/v1/customers/cus_35da5436-a730-11e6-a5a0-d32f2a781b50
|
115
|
+
body:
|
116
|
+
encoding: UTF-8
|
117
|
+
string: "{}"
|
118
|
+
headers:
|
119
|
+
User-Agent:
|
120
|
+
- Faraday v0.9.2
|
121
|
+
Content-Type:
|
122
|
+
- application/json
|
123
|
+
Authorization:
|
124
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
125
|
+
response:
|
126
|
+
status:
|
127
|
+
code: 404
|
128
|
+
message:
|
129
|
+
headers:
|
130
|
+
server:
|
131
|
+
- nginx/1.10.1
|
132
|
+
date:
|
133
|
+
- Thu, 10 Nov 2016 10:37:08 GMT
|
134
|
+
content-type:
|
135
|
+
- application/json
|
136
|
+
content-length:
|
137
|
+
- '111'
|
138
|
+
connection:
|
139
|
+
- close
|
140
|
+
status:
|
141
|
+
- 404 Not Found
|
142
|
+
body:
|
143
|
+
encoding: UTF-8
|
144
|
+
string: '{"code":404,"message":"Customer \"35da5436-a730-11e6-a5a0-d32f2a781b50\"
|
145
|
+
does not exist","param":"customer_id"}'
|
146
|
+
http_version:
|
147
|
+
recorded_at: Thu, 10 Nov 2016 10:37:08 GMT
|
148
|
+
- request:
|
149
|
+
method: get
|
150
|
+
uri: https://api.chartmogul.com/v1/customers/cus_fc5451ee-a72f-11e6-9019-3b1a0ecf3c73
|
151
|
+
body:
|
152
|
+
encoding: UTF-8
|
153
|
+
string: "{}"
|
154
|
+
headers:
|
155
|
+
User-Agent:
|
156
|
+
- Faraday v0.9.2
|
157
|
+
Content-Type:
|
158
|
+
- application/json
|
159
|
+
Authorization:
|
160
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
161
|
+
response:
|
162
|
+
status:
|
163
|
+
code: 200
|
164
|
+
message:
|
165
|
+
headers:
|
166
|
+
server:
|
167
|
+
- nginx/1.10.1
|
168
|
+
date:
|
169
|
+
- Thu, 10 Nov 2016 10:45:35 GMT
|
170
|
+
content-type:
|
171
|
+
- application/json
|
172
|
+
content-length:
|
173
|
+
- '512'
|
174
|
+
connection:
|
175
|
+
- close
|
176
|
+
status:
|
177
|
+
- 200 OK
|
178
|
+
access-control-allow-credentials:
|
179
|
+
- 'true'
|
180
|
+
body:
|
181
|
+
encoding: UTF-8
|
182
|
+
string: '{"id":6474475,"uuid":"cus_fc5451ee-a72f-11e6-9019-3b1a0ecf3c73","external_id":"7ea39c1b-2286-4cb7-b1c8-9a63e8358875","name":"into@merge.com","email":"into@merge.com","status":"Lead","customer-since":null,"attributes":{"tags":["merged-customer"]},"address":{"country":"Angola","state":null,"city":null,"address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/6474475-into_merge_com","billing-system-type":"Manual","currency":"UGX","currency-sign":null}'
|
183
|
+
http_version:
|
184
|
+
recorded_at: Thu, 10 Nov 2016 10:45:35 GMT
|
185
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,86 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/customers/cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
server:
|
22
|
+
- nginx/1.10.1
|
23
|
+
date:
|
24
|
+
- Thu, 10 Nov 2016 14:35:00 GMT
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
content-length:
|
28
|
+
- '1104'
|
29
|
+
connection:
|
30
|
+
- close
|
31
|
+
vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
status:
|
34
|
+
- 200 OK
|
35
|
+
access-control-allow-credentials:
|
36
|
+
- 'true'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":6474391,"uuid":"cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e","external_id":"14c58821-ad87-467d-956f-95f35f2cdd3d","name":"Currywurst","email":"curry@wurst.com","status":"Lead","customer-since":null,"attributes":{"tags":["wurst"],"clearbit":{"company":{"category":{"industry":"Commercial
|
40
|
+
Services \u0026 Supplies","industryGroup":"Commercial \u0026 Professional
|
41
|
+
Services","sector":"Industrials","subIndustry":"Corporate \u0026 Business"},"geo":{"city":"Lakewood","country":"United
|
42
|
+
States","postalCode":"80228","state":"Colorado","streetName":"South Union
|
43
|
+
Boulevard","streetNumber":"165","subPremise":"260"},"metrics":{"alexaGlobalRank":3418524,"alexaUsRank":793393},"name":"CCG","timeZone":"America/Denver","twitter":{"followers":1449,"handle":"CustomerProfit"},"type":"private","utcOffset":-7}},"custom":{"meinung":["lecker"]}},"address":{"country":"Germany","state":"New
|
44
|
+
York","city":"Berlin","address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/6474391-Currywurst","billing-system-type":"Manual","currency":"UGX","currency-sign":null}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Thu, 10 Nov 2016 14:35:00 GMT
|
47
|
+
- request:
|
48
|
+
method: patch
|
49
|
+
uri: https://api.chartmogul.com/v1/customers/cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '{"name":"Currywurst","email":"schnitzel.com","attributes":{"tags":["wurst"],"clearbit":{"company":{"category":{"industry":"Commercial
|
53
|
+
Services & Supplies","industry_group":"Commercial & Professional Services","sector":"Industrials","sub_industry":"Corporate
|
54
|
+
& Business"},"geo":{"city":"Lakewood","country":"United States","postal_code":"80228","state":"Colorado","street_name":"South
|
55
|
+
Union Boulevard","street_number":"165","sub_premise":"260"},"metrics":{"alexa_global_rank":3418524,"alexa_us_rank":793393},"name":"CCG","time_zone":"America/Denver","twitter":{"followers":1449,"handle":"CustomerProfit"},"type":"private","utc_offset":-7}},"custom":{"meinung":["lecker"]}}}'
|
56
|
+
headers:
|
57
|
+
User-Agent:
|
58
|
+
- Faraday v0.9.2
|
59
|
+
Content-Type:
|
60
|
+
- application/json
|
61
|
+
Authorization:
|
62
|
+
- Basic eGdKZWFVUDNhY3lCV1NIQkxuVmFHdzplMTdiMGY5ZTkyMmZiNjJlOTI0YmNhYTcwYmUyOTBmOQ==
|
63
|
+
response:
|
64
|
+
status:
|
65
|
+
code: 422
|
66
|
+
message:
|
67
|
+
headers:
|
68
|
+
server:
|
69
|
+
- nginx/1.10.1
|
70
|
+
date:
|
71
|
+
- Thu, 10 Nov 2016 14:35:00 GMT
|
72
|
+
content-type:
|
73
|
+
- application/json
|
74
|
+
content-length:
|
75
|
+
- '104'
|
76
|
+
connection:
|
77
|
+
- close
|
78
|
+
status:
|
79
|
+
- 422 Unprocessable Entity
|
80
|
+
body:
|
81
|
+
encoding: UTF-8
|
82
|
+
string: '{"code":422,"message":"The value provided does not appear to be a valid
|
83
|
+
email address.","param":"email"}'
|
84
|
+
http_version:
|
85
|
+
recorded_at: Thu, 10 Nov 2016 14:35:00 GMT
|
86
|
+
recorded_with: VCR 3.0.3
|
data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/updates_customer.yml
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/customers/cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "{}"
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
server:
|
22
|
+
- nginx/1.10.1
|
23
|
+
date:
|
24
|
+
- Thu, 10 Nov 2016 12:35:59 GMT
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
content-length:
|
28
|
+
- '1069'
|
29
|
+
connection:
|
30
|
+
- close
|
31
|
+
vary:
|
32
|
+
- Accept-Encoding
|
33
|
+
status:
|
34
|
+
- 200 OK
|
35
|
+
access-control-allow-credentials:
|
36
|
+
- 'true'
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"id":6474391,"uuid":"cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e","external_id":"14c58821-ad87-467d-956f-95f35f2cdd3d","name":"Update
|
40
|
+
Customer","email":"update@customer.com","status":"Lead","customer-since":null,"attributes":{"tags":[],"clearbit":{"company":{"category":{"industry":"Commercial
|
41
|
+
Services \u0026 Supplies","industryGroup":"Commercial \u0026 Professional
|
42
|
+
Services","sector":"Industrials","subIndustry":"Corporate \u0026 Business"},"geo":{"city":"Lakewood","country":"United
|
43
|
+
States","postalCode":"80228","state":"Colorado","streetName":"South Union
|
44
|
+
Boulevard","streetNumber":"165","subPremise":"260"},"metrics":{"alexaGlobalRank":3418524,"alexaUsRank":793393},"name":"CCG","timeZone":"America/Denver","twitter":{"followers":1449,"handle":"CustomerProfit"},"type":"private","utcOffset":-7}}},"address":{"country":"Armenia","state":null,"city":null,"address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/6474391-Update_Customer","billing-system-type":"Manual","currency":"UGX","currency-sign":null}'
|
45
|
+
http_version:
|
46
|
+
recorded_at: Thu, 10 Nov 2016 12:36:00 GMT
|
47
|
+
- request:
|
48
|
+
method: patch
|
49
|
+
uri: https://api.chartmogul.com/v1/customers/cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e
|
50
|
+
body:
|
51
|
+
encoding: UTF-8
|
52
|
+
string: '{"name":"Currywurst","email":"curry@wurst.com","company":"Curry 36","country":"DE","state":"NY","city":"Berlin","lead_created_at":"2016-01-01
|
53
|
+
14:30:00 UTC","free_trial_started_at":"2016-02-02 22:40:00 UTC","attributes":{"tags":["wurst"],"clearbit":{"company":{"category":{"industry":"Commercial
|
54
|
+
Services & Supplies","industry_group":"Commercial & Professional Services","sector":"Industrials","sub_industry":"Corporate
|
55
|
+
& Business"},"geo":{"city":"Lakewood","country":"United States","postal_code":"80228","state":"Colorado","street_name":"South
|
56
|
+
Union Boulevard","street_number":"165","sub_premise":"260"},"metrics":{"alexa_global_rank":3418524,"alexa_us_rank":793393},"name":"CCG","time_zone":"America/Denver","twitter":{"followers":1449,"handle":"CustomerProfit"},"type":"private","utc_offset":-7}},"custom":{"meinung":["lecker"]}}}'
|
57
|
+
headers:
|
58
|
+
User-Agent:
|
59
|
+
- Faraday v0.9.2
|
60
|
+
Content-Type:
|
61
|
+
- application/json
|
62
|
+
Authorization:
|
63
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
64
|
+
response:
|
65
|
+
status:
|
66
|
+
code: 200
|
67
|
+
message:
|
68
|
+
headers:
|
69
|
+
server:
|
70
|
+
- nginx/1.10.1
|
71
|
+
date:
|
72
|
+
- Thu, 10 Nov 2016 12:36:00 GMT
|
73
|
+
content-type:
|
74
|
+
- application/json
|
75
|
+
content-length:
|
76
|
+
- '1354'
|
77
|
+
connection:
|
78
|
+
- close
|
79
|
+
vary:
|
80
|
+
- Accept-Encoding
|
81
|
+
status:
|
82
|
+
- 200 OK
|
83
|
+
access-control-allow-credentials:
|
84
|
+
- 'true'
|
85
|
+
body:
|
86
|
+
encoding: UTF-8
|
87
|
+
string: '{"id":6474391,"uuid":"cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e","external_id":"14c58821-ad87-467d-956f-95f35f2cdd3d","name":"Currywurst","email":"curry@wurst.com","status":"Lead","customer-since":null,"attributes":{"custom":{"meinung":["lecker"]},"clearbit":{"company":{"category":{"industry":"Commercial
|
88
|
+
Services & Supplies","industryGroup":"Commercial & Professional Services","sector":"Industrials","subIndustry":"Corporate
|
89
|
+
& Business"},"geo":{"city":"Lakewood","country":"United States","postalCode":"80228","state":"Colorado","streetName":"South
|
90
|
+
Union Boulevard","streetNumber":"165","subPremise":"260"},"metrics":{"alexaGlobalRank":3418524,"alexaUsRank":793393},"name":"CCG","timeZone":"America/Denver","twitter":{"followers":1449,"handle":"CustomerProfit"},"type":"private","utcOffset":-7}},"stripe":{},"tags":["wurst"]},"company":"Curry
|
91
|
+
36","country":"DE","state":"NY","city":"Berlin","zip":null,"lead_created_at":"2016-01-01T14:30:00.000Z","free_trial_started_at":"2016-02-02T22:40:00.000Z","address":{"country":"DE","state":"New
|
92
|
+
York","city":"Berlin","address_zip":null},"mrr":0,"arr":0,"chartmogul-url":"https://app.chartmogul.com/#customers/6474391-Currywurst","data_source_uuid":"ds_5ef7f768-62ea-11e6-8299-5bf2ca7f76bb","data_source_uuids":["ds_5ef7f768-62ea-11e6-8299-5bf2ca7f76bb"],"external_ids":["14c58821-ad87-467d-956f-95f35f2cdd3d"]}'
|
93
|
+
http_version:
|
94
|
+
recorded_at: Thu, 10 Nov 2016 12:36:00 GMT
|
95
|
+
- request:
|
96
|
+
method: get
|
97
|
+
uri: https://api.chartmogul.com/v1/customers/cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e
|
98
|
+
body:
|
99
|
+
encoding: UTF-8
|
100
|
+
string: "{}"
|
101
|
+
headers:
|
102
|
+
User-Agent:
|
103
|
+
- Faraday v0.9.2
|
104
|
+
Content-Type:
|
105
|
+
- application/json
|
106
|
+
Authorization:
|
107
|
+
- Basic MDFiNzI2YzI0ZjNiYjhlOTc0MmEwNGZiMDhhZmE3NzQ6NzJlNGMxYTdlZTFiYzlkNGZjMDBlZWUwNWIyN2QzMGY=
|
108
|
+
response:
|
109
|
+
status:
|
110
|
+
code: 200
|
111
|
+
message:
|
112
|
+
headers:
|
113
|
+
server:
|
114
|
+
- nginx/1.10.1
|
115
|
+
date:
|
116
|
+
- Thu, 10 Nov 2016 12:36:00 GMT
|
117
|
+
content-type:
|
118
|
+
- application/json
|
119
|
+
content-length:
|
120
|
+
- '1104'
|
121
|
+
connection:
|
122
|
+
- close
|
123
|
+
vary:
|
124
|
+
- Accept-Encoding
|
125
|
+
status:
|
126
|
+
- 200 OK
|
127
|
+
access-control-allow-credentials:
|
128
|
+
- 'true'
|
129
|
+
body:
|
130
|
+
encoding: UTF-8
|
131
|
+
string: '{"id":6474391,"uuid":"cus_782b0716-a728-11e6-8eab-a7d0e8cd5c1e","external_id":"14c58821-ad87-467d-956f-95f35f2cdd3d","name":"Currywurst","email":"curry@wurst.com","status":"Lead","customer-since":null,"attributes":{"tags":["wurst"],"clearbit":{"company":{"category":{"industry":"Commercial
|
132
|
+
Services \u0026 Supplies","industryGroup":"Commercial \u0026 Professional
|
133
|
+
Services","sector":"Industrials","subIndustry":"Corporate \u0026 Business"},"geo":{"city":"Lakewood","country":"United
|
134
|
+
States","postalCode":"80228","state":"Colorado","streetName":"South Union
|
135
|
+
Boulevard","streetNumber":"165","subPremise":"260"},"metrics":{"alexaGlobalRank":3418524,"alexaUsRank":793393},"name":"CCG","timeZone":"America/Denver","twitter":{"followers":1449,"handle":"CustomerProfit"},"type":"private","utcOffset":-7}},"custom":{"meinung":["lecker"]}},"address":{"country":"Germany","state":"New
|
136
|
+
York","city":"Berlin","address_zip":null},"mrr":0,"arr":0,"billing-system-url":null,"chartmogul-url":"https://app.chartmogul.com/#customers/6474391-Currywurst","billing-system-type":"Manual","currency":"UGX","currency-sign":null}'
|
137
|
+
http_version:
|
138
|
+
recorded_at: Thu, 10 Nov 2016 12:36:00 GMT
|
139
|
+
recorded_with: VCR 3.0.3
|
@@ -27,7 +27,7 @@ module ChartMogul
|
|
27
27
|
end
|
28
28
|
|
29
29
|
def custom!(http_method, http_path, body_data = {})
|
30
|
-
json = custom_without_assign!(http_method, http_path, body_data
|
30
|
+
json = custom_without_assign!(http_method, http_path, body_data)
|
31
31
|
|
32
32
|
if resource_root_key && json.key?(resource_root_key)
|
33
33
|
json[resource_root_key].map { |attributes| new_from_json(attributes) }
|
@@ -2,15 +2,13 @@ module ChartMogul
|
|
2
2
|
module Enrichment
|
3
3
|
class Customer < APIResource
|
4
4
|
set_resource_name 'Customer'
|
5
|
+
set_resource_path '/v1/customers'
|
5
6
|
|
6
7
|
readonly_attr :id
|
7
8
|
readonly_attr :uuid
|
8
9
|
readonly_attr :external_id
|
9
|
-
readonly_attr :name
|
10
|
-
readonly_attr :email
|
11
10
|
readonly_attr :status
|
12
11
|
readonly_attr :customer_since, type: :time
|
13
|
-
readonly_attr :attributes
|
14
12
|
readonly_attr :address
|
15
13
|
readonly_attr :mrr
|
16
14
|
readonly_attr :arr
|
@@ -20,7 +18,18 @@ module ChartMogul
|
|
20
18
|
readonly_attr :currency
|
21
19
|
readonly_attr :currency_sign
|
22
20
|
|
21
|
+
writeable_attr :name
|
22
|
+
writeable_attr :email
|
23
|
+
writeable_attr :company
|
24
|
+
writeable_attr :country
|
25
|
+
writeable_attr :state
|
26
|
+
writeable_attr :city
|
27
|
+
writeable_attr :lead_created_at
|
28
|
+
writeable_attr :free_trial_started_at
|
29
|
+
writeable_attr :attributes
|
30
|
+
|
23
31
|
include API::Actions::Custom
|
32
|
+
include API::Actions::Update
|
24
33
|
|
25
34
|
def tags
|
26
35
|
@attributes[:tags]
|
@@ -60,6 +69,15 @@ module ChartMogul
|
|
60
69
|
custom: custom_attrs)[:custom]
|
61
70
|
end
|
62
71
|
|
72
|
+
def merge_into!(other_customer)
|
73
|
+
options = {
|
74
|
+
from: { customer_uuid: uuid },
|
75
|
+
into: { customer_uuid: other_customer.uuid }
|
76
|
+
}
|
77
|
+
custom!(:post, '/v1/customers/merges', options)
|
78
|
+
true
|
79
|
+
end
|
80
|
+
|
63
81
|
def self.retrieve(uuid)
|
64
82
|
custom!(:get, "/v1/customers/#{uuid}")
|
65
83
|
end
|
data/lib/chartmogul/version.rb
CHANGED
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: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Langenauer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -117,13 +117,16 @@ files:
|
|
117
117
|
- fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_422.yml
|
118
118
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/adds_custom_attributes.yml
|
119
119
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/adds_required_tags.yml
|
120
|
+
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/merges_customers.yml
|
120
121
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/raises_404_if_no_customers_found.yml
|
122
|
+
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/raises_422_for_update_with_invalid_data.yml
|
121
123
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/removes_custom_attributes.yml
|
122
124
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/removes_tags.yml
|
123
125
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/returns_all_customers_through_list_all_endpoint.yml
|
124
126
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/returns_customer_through_retrieve_endpoint.yml
|
125
127
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/returns_right_customers_through_search_endpoint.yml
|
126
128
|
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/updates_custom_attributes.yml
|
129
|
+
- fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/updates_customer.yml
|
127
130
|
- fixtures/vcr_cassettes/ChartMogul_Import_Customer/API_Interactions/correctly_handles_a_422_response.yml
|
128
131
|
- fixtures/vcr_cassettes/ChartMogul_Import_Customer/API_Interactions/correctly_interracts_with_the_API.yml
|
129
132
|
- fixtures/vcr_cassettes/ChartMogul_Import_Customer/_find_by_external_id/when_external_id_is_provided/returns_matching_user_if_exists.yml
|