chartmogul-ruby 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +9 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +4 -0
  5. data/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -0
  6. data/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -0
  7. data/Gemfile +4 -0
  8. data/LICENSE.txt +21 -0
  9. data/README.md +82 -0
  10. data/Rakefile +6 -0
  11. data/bin/console +14 -0
  12. data/bin/setup +8 -0
  13. data/changelog.md +8 -0
  14. data/chartmogul-ruby.gemspec +29 -0
  15. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_interracts_with_the_API.yml +189 -0
  16. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_404.yml +46 -0
  17. data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_422.yml +48 -0
  18. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/adds_custom_attributes.yml +80 -0
  19. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/adds_required_tags.yml +79 -0
  20. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/raises_404_if_no_customers_found.yml +38 -0
  21. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/removes_custom_attributes.yml +80 -0
  22. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/removes_tags.yml +80 -0
  23. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/returns_all_customers_through_list_all_endpoint.yml +47 -0
  24. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/returns_customer_through_retrieve_endpoint.yml +42 -0
  25. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/returns_right_customers_through_search_endpoint.yml +43 -0
  26. data/fixtures/vcr_cassettes/ChartMogul_Enrichment_Customer/API_Interactions/updates_custom_attributes.yml +82 -0
  27. data/fixtures/vcr_cassettes/ChartMogul_Import_Customer/API_Interactions/correctly_handles_a_422_response.yml +50 -0
  28. data/fixtures/vcr_cassettes/ChartMogul_Import_Customer/API_Interactions/correctly_interracts_with_the_API.yml +240 -0
  29. data/fixtures/vcr_cassettes/ChartMogul_Import_CustomerInvoices/API_Interactions/correctly_interracts_with_the_API.yml +298 -0
  30. data/fixtures/vcr_cassettes/ChartMogul_Import_DataSource/API_Interactions/correctly_interracts_with_the_API.yml +189 -0
  31. data/fixtures/vcr_cassettes/ChartMogul_Import_DataSource/API_Interactions/correctly_raises_errors_on_404.yml +46 -0
  32. data/fixtures/vcr_cassettes/ChartMogul_Import_DataSource/API_Interactions/correctly_raises_errors_on_422.yml +48 -0
  33. data/fixtures/vcr_cassettes/ChartMogul_Import_Plan/API_Interractions/correctly_handles_a_422_error.yml +51 -0
  34. data/fixtures/vcr_cassettes/ChartMogul_Import_Plan/API_Interractions/correctly_interracts_with_the_API.yml +152 -0
  35. data/fixtures/vcr_cassettes/ChartMogul_Import_Subscription/API_Interactions/correctly_interracts_with_the_API.yml +340 -0
  36. data/fixtures/vcr_cassettes/ChartMogul_Import_Transactions_Payment/API_Interactions/correctly_interracts_with_the_API.yml +243 -0
  37. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +42 -0
  38. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/should_have_entries.yml +42 -0
  39. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +42 -0
  40. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/should_have_entries.yml +42 -0
  41. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -0
  42. data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -0
  43. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/behaves_like_Pageable/should_be_pageable.yml +41 -0
  44. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/should_have_Activity_entries.yml +41 -0
  45. data/fixtures/vcr_cassettes/ChartMogul_Metrics_AllKeyMetric/should_have_entries.yml +42 -0
  46. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -0
  47. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -0
  48. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +42 -0
  49. data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/should_have_entries.yml +42 -0
  50. data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -0
  51. data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -0
  52. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/behaves_like_Summary/should_have_summary.yml +42 -0
  53. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/should_have_entries.yml +42 -0
  54. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -0
  55. data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -0
  56. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Subscription/behaves_like_Pageable/should_be_pageable.yml +40 -0
  57. data/fixtures/vcr_cassettes/ChartMogul_Metrics_Subscription/should_have_Subscription_entries.yml +40 -0
  58. data/lib/chartmogul.rb +77 -0
  59. data/lib/chartmogul/api/actions/all.rb +28 -0
  60. data/lib/chartmogul/api/actions/create.rb +39 -0
  61. data/lib/chartmogul/api/actions/custom.rb +42 -0
  62. data/lib/chartmogul/api/actions/destroy.rb +14 -0
  63. data/lib/chartmogul/api/actions/update.rb +19 -0
  64. data/lib/chartmogul/api_resource.rb +57 -0
  65. data/lib/chartmogul/concerns/entries.rb +37 -0
  66. data/lib/chartmogul/concerns/pageable.rb +14 -0
  67. data/lib/chartmogul/concerns/summary.rb +20 -0
  68. data/lib/chartmogul/config_attributes.rb +15 -0
  69. data/lib/chartmogul/configuration.rb +6 -0
  70. data/lib/chartmogul/enrichment/customer.rb +114 -0
  71. data/lib/chartmogul/errors/chartmogul_error.rb +19 -0
  72. data/lib/chartmogul/errors/configuration_error.rb +4 -0
  73. data/lib/chartmogul/errors/forbidden_error.rb +4 -0
  74. data/lib/chartmogul/errors/not_found_error.rb +4 -0
  75. data/lib/chartmogul/errors/resource_invalid_error.rb +4 -0
  76. data/lib/chartmogul/errors/schema_invalid_error.rb +4 -0
  77. data/lib/chartmogul/import/customer.rb +38 -0
  78. data/lib/chartmogul/import/customer_invoices.rb +40 -0
  79. data/lib/chartmogul/import/data_source.rb +19 -0
  80. data/lib/chartmogul/import/invoice.rb +64 -0
  81. data/lib/chartmogul/import/line_items/one_time.rb +25 -0
  82. data/lib/chartmogul/import/line_items/subscription.rb +31 -0
  83. data/lib/chartmogul/import/plan.rb +21 -0
  84. data/lib/chartmogul/import/subscription.rb +30 -0
  85. data/lib/chartmogul/import/transactions/payment.rb +26 -0
  86. data/lib/chartmogul/import/transactions/refund.rb +26 -0
  87. data/lib/chartmogul/metrics/activity.rb +32 -0
  88. data/lib/chartmogul/metrics/all_key_metrics.rb +25 -0
  89. data/lib/chartmogul/metrics/arpa.rb +19 -0
  90. data/lib/chartmogul/metrics/arr.rb +19 -0
  91. data/lib/chartmogul/metrics/asp.rb +19 -0
  92. data/lib/chartmogul/metrics/base.rb +56 -0
  93. data/lib/chartmogul/metrics/customer_churn_rate.rb +19 -0
  94. data/lib/chartmogul/metrics/customer_count.rb +19 -0
  95. data/lib/chartmogul/metrics/ltv.rb +19 -0
  96. data/lib/chartmogul/metrics/mrr.rb +26 -0
  97. data/lib/chartmogul/metrics/mrr_churn_rate.rb +19 -0
  98. data/lib/chartmogul/metrics/subscription.rb +35 -0
  99. data/lib/chartmogul/object.rb +119 -0
  100. data/lib/chartmogul/resource_path.rb +42 -0
  101. data/lib/chartmogul/summary.rb +7 -0
  102. data/lib/chartmogul/utils/hash_snake_caser.rb +50 -0
  103. data/lib/chartmogul/utils/json_parser.rb +11 -0
  104. data/lib/chartmogul/version.rb +3 -0
  105. metadata +232 -0
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: delete
5
+ uri: https://api.chartmogul.com/v1/import/data_sources/1234-a-uuid-that-doesnt-exist
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Authorization:
13
+ - Basic ZTk5MGJkMjNmNTQzYWNjZGY3ZDg4Yjk2OWNiMzAwOWI6NWM4YThlY2UxMTFmYmE4NTE1MGVmNzBjYmZmM2I3ZWI=
14
+ response:
15
+ status:
16
+ code: 404
17
+ message:
18
+ headers:
19
+ server:
20
+ - nginx/1.9.10
21
+ date:
22
+ - Sun, 05 Jun 2016 18:52:12 GMT
23
+ content-type:
24
+ - application/json; charset=utf-8
25
+ transfer-encoding:
26
+ - chunked
27
+ connection:
28
+ - close
29
+ x-frame-options:
30
+ - SAMEORIGIN
31
+ x-xss-protection:
32
+ - 1; mode=block
33
+ x-content-type-options:
34
+ - nosniff
35
+ cache-control:
36
+ - no-cache
37
+ x-request-id:
38
+ - dd910032-2b3d-4ce7-8caa-99c7bd562431
39
+ x-runtime:
40
+ - '0.007264'
41
+ body:
42
+ encoding: UTF-8
43
+ string: '{"error":"Data source not found"}'
44
+ http_version:
45
+ recorded_at: Sun, 05 Jun 2016 18:52:12 GMT
46
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.chartmogul.com/v1/import/data_sources
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":null}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Basic ZTk5MGJkMjNmNTQzYWNjZGY3ZDg4Yjk2OWNiMzAwOWI6NWM4YThlY2UxMTFmYmE4NTE1MGVmNzBjYmZmM2I3ZWI=
16
+ response:
17
+ status:
18
+ code: 422
19
+ message:
20
+ headers:
21
+ server:
22
+ - nginx/1.9.10
23
+ date:
24
+ - Sun, 05 Jun 2016 18:52:12 GMT
25
+ content-type:
26
+ - application/json; charset=utf-8
27
+ transfer-encoding:
28
+ - chunked
29
+ connection:
30
+ - close
31
+ x-frame-options:
32
+ - SAMEORIGIN
33
+ x-xss-protection:
34
+ - 1; mode=block
35
+ x-content-type-options:
36
+ - nosniff
37
+ cache-control:
38
+ - no-cache
39
+ x-request-id:
40
+ - 2b95156f-88a2-4433-b949-e2233a546341
41
+ x-runtime:
42
+ - '0.014123'
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"errors":{"name":"A name is required for each data source."}}'
46
+ http_version:
47
+ recorded_at: Sun, 05 Jun 2016 18:52:12 GMT
48
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,51 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.chartmogul.com/v1/import/plans
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"data_source_uuid":null,"name":null,"interval_count":null,"interval_unit":null,"external_id":null}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Basic ODE2MjZkMWFiMzU5NTIwMzY5MjhjNjJjYmJiNDMyN2M6ODY3MDRmMDdkYzQwZmYzYjYyYzRjY2E5OTYxMjk2MzY=
16
+ response:
17
+ status:
18
+ code: 422
19
+ message:
20
+ headers:
21
+ server:
22
+ - nginx/1.9.10
23
+ date:
24
+ - Sun, 05 Jun 2016 19:47:08 GMT
25
+ content-type:
26
+ - application/json; charset=utf-8
27
+ transfer-encoding:
28
+ - chunked
29
+ connection:
30
+ - close
31
+ x-frame-options:
32
+ - SAMEORIGIN
33
+ x-xss-protection:
34
+ - 1; mode=block
35
+ x-content-type-options:
36
+ - nosniff
37
+ cache-control:
38
+ - no-cache
39
+ x-request-id:
40
+ - 72fc5d2e-0e09-4d62-b0b6-c10299d79c0a
41
+ x-runtime:
42
+ - '0.026567'
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"errors":{"name":"A unique name is required for each plan.","interval_count":"is
46
+ not a number","interval_unit":"Only ''day'', ''month'' or ''year'' are valid
47
+ values for interval_unit.","data_source_uuid":"A valid data source UUID is
48
+ required for each plan."}}'
49
+ http_version:
50
+ recorded_at: Sun, 05 Jun 2016 19:47:08 GMT
51
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,152 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.chartmogul.com/v1/import/data_sources
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Another Data Source"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.1
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Basic ODE2MjZkMWFiMzU5NTIwMzY5MjhjNjJjYmJiNDMyN2M6ODY3MDRmMDdkYzQwZmYzYjYyYzRjY2E5OTYxMjk2MzY=
16
+ response:
17
+ status:
18
+ code: 201
19
+ message:
20
+ headers:
21
+ server:
22
+ - nginx/1.9.10
23
+ date:
24
+ - Sun, 05 Jun 2016 19:47:08 GMT
25
+ content-type:
26
+ - application/json; charset=utf-8
27
+ transfer-encoding:
28
+ - chunked
29
+ connection:
30
+ - close
31
+ x-frame-options:
32
+ - SAMEORIGIN
33
+ x-xss-protection:
34
+ - 1; mode=block
35
+ x-content-type-options:
36
+ - nosniff
37
+ etag:
38
+ - W/"05335923b74e9c38a5a5fe8e83ac0f79"
39
+ cache-control:
40
+ - max-age=0, private, must-revalidate
41
+ x-request-id:
42
+ - e163c0c6-e937-4427-a0c8-78bd5e3f1711
43
+ x-runtime:
44
+ - '0.509776'
45
+ strict-transport-security:
46
+ - max-age=15768000
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"uuid":"ds_77eb401d-fff6-43be-94dc-2cbc2e96e31e","name":"Another Data
50
+ Source","created_at":"2016-06-05T19:47:08.020Z","status":"never_imported"}'
51
+ http_version:
52
+ recorded_at: Sun, 05 Jun 2016 19:47:08 GMT
53
+ - request:
54
+ method: post
55
+ uri: https://api.chartmogul.com/v1/import/plans
56
+ body:
57
+ encoding: UTF-8
58
+ string: '{"data_source_uuid":"ds_77eb401d-fff6-43be-94dc-2cbc2e96e31e","name":"A
59
+ Test Plan","interval_count":1,"interval_unit":"month","external_id":null}'
60
+ headers:
61
+ User-Agent:
62
+ - Faraday v0.9.1
63
+ Content-Type:
64
+ - application/json
65
+ Authorization:
66
+ - Basic ODE2MjZkMWFiMzU5NTIwMzY5MjhjNjJjYmJiNDMyN2M6ODY3MDRmMDdkYzQwZmYzYjYyYzRjY2E5OTYxMjk2MzY=
67
+ response:
68
+ status:
69
+ code: 201
70
+ message:
71
+ headers:
72
+ server:
73
+ - nginx/1.9.10
74
+ date:
75
+ - Sun, 05 Jun 2016 19:47:08 GMT
76
+ content-type:
77
+ - application/json; charset=utf-8
78
+ transfer-encoding:
79
+ - chunked
80
+ connection:
81
+ - close
82
+ x-frame-options:
83
+ - SAMEORIGIN
84
+ x-xss-protection:
85
+ - 1; mode=block
86
+ x-content-type-options:
87
+ - nosniff
88
+ etag:
89
+ - W/"7086a2e8b932cc1ce3b47f8de5fdfdb8"
90
+ cache-control:
91
+ - max-age=0, private, must-revalidate
92
+ x-request-id:
93
+ - 6e97fa02-8bc1-4d2f-8718-8473a58e4254
94
+ x-runtime:
95
+ - '0.120821'
96
+ strict-transport-security:
97
+ - max-age=15768000
98
+ body:
99
+ encoding: UTF-8
100
+ string: '{"uuid":"pl_ba808f0b-4c1c-4824-8705-a6736efa96dc","external_id":null,"name":"A
101
+ Test Plan","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_77eb401d-fff6-43be-94dc-2cbc2e96e31e"}'
102
+ http_version:
103
+ recorded_at: Sun, 05 Jun 2016 19:47:08 GMT
104
+ - request:
105
+ method: get
106
+ uri: https://api.chartmogul.com/v1/import/plans
107
+ body:
108
+ encoding: US-ASCII
109
+ string: ''
110
+ headers:
111
+ User-Agent:
112
+ - Faraday v0.9.1
113
+ Authorization:
114
+ - Basic ODE2MjZkMWFiMzU5NTIwMzY5MjhjNjJjYmJiNDMyN2M6ODY3MDRmMDdkYzQwZmYzYjYyYzRjY2E5OTYxMjk2MzY=
115
+ response:
116
+ status:
117
+ code: 200
118
+ message:
119
+ headers:
120
+ server:
121
+ - nginx/1.9.10
122
+ date:
123
+ - Sun, 05 Jun 2016 19:47:08 GMT
124
+ content-type:
125
+ - application/json; charset=utf-8
126
+ transfer-encoding:
127
+ - chunked
128
+ connection:
129
+ - close
130
+ x-frame-options:
131
+ - SAMEORIGIN
132
+ x-xss-protection:
133
+ - 1; mode=block
134
+ x-content-type-options:
135
+ - nosniff
136
+ etag:
137
+ - W/"2122e94312ef92cc077db62910743655"
138
+ cache-control:
139
+ - max-age=0, private, must-revalidate
140
+ x-request-id:
141
+ - 1286c5a2-596a-4bc2-9e24-cfccc393e589
142
+ x-runtime:
143
+ - '0.018019'
144
+ strict-transport-security:
145
+ - max-age=15768000
146
+ body:
147
+ encoding: UTF-8
148
+ string: '{"plans":[{"uuid":"pl_ba808f0b-4c1c-4824-8705-a6736efa96dc","external_id":null,"name":"A
149
+ Test Plan","interval_count":1,"interval_unit":"month","data_source_uuid":"ds_77eb401d-fff6-43be-94dc-2cbc2e96e31e"}],"current_page":1,"total_pages":1}'
150
+ http_version:
151
+ recorded_at: Sun, 05 Jun 2016 19:47:08 GMT
152
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,340 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.chartmogul.com/v1/import/data_sources
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"name":"Subscription Test Data Source"}'
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.9.2
12
+ Content-Type:
13
+ - application/json
14
+ Authorization:
15
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
16
+ response:
17
+ status:
18
+ code: 201
19
+ message:
20
+ headers:
21
+ server:
22
+ - nginx/1.9.10
23
+ date:
24
+ - Thu, 23 Jun 2016 20:46:05 GMT
25
+ content-type:
26
+ - application/json; charset=utf-8
27
+ transfer-encoding:
28
+ - chunked
29
+ connection:
30
+ - close
31
+ x-frame-options:
32
+ - SAMEORIGIN
33
+ x-xss-protection:
34
+ - 1; mode=block
35
+ x-content-type-options:
36
+ - nosniff
37
+ etag:
38
+ - W/"d9f558c2b556b28cdcc9c323d3ac66dd"
39
+ cache-control:
40
+ - max-age=0, private, must-revalidate
41
+ x-request-id:
42
+ - 4333819d-8abb-4310-b475-1c6b4adb5c9f
43
+ x-runtime:
44
+ - '0.507565'
45
+ strict-transport-security:
46
+ - max-age=15768000
47
+ body:
48
+ encoding: UTF-8
49
+ string: '{"uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6","name":"Subscription
50
+ Test Data Source","created_at":"2016-06-23T20:46:05.645Z","status":"never_imported"}'
51
+ http_version:
52
+ recorded_at: Thu, 23 Jun 2016 20:46:05 GMT
53
+ - request:
54
+ method: post
55
+ uri: https://api.chartmogul.com/v1/import/customers
56
+ body:
57
+ encoding: UTF-8
58
+ string: '{"data_source_uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6","external_id":"test_cus_ext_id","name":"Test
59
+ Customer"}'
60
+ headers:
61
+ User-Agent:
62
+ - Faraday v0.9.2
63
+ Content-Type:
64
+ - application/json
65
+ Authorization:
66
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
67
+ response:
68
+ status:
69
+ code: 201
70
+ message:
71
+ headers:
72
+ server:
73
+ - nginx/1.9.10
74
+ date:
75
+ - Thu, 23 Jun 2016 20:46:06 GMT
76
+ content-type:
77
+ - application/json; charset=utf-8
78
+ transfer-encoding:
79
+ - chunked
80
+ connection:
81
+ - close
82
+ x-frame-options:
83
+ - SAMEORIGIN
84
+ x-xss-protection:
85
+ - 1; mode=block
86
+ x-content-type-options:
87
+ - nosniff
88
+ etag:
89
+ - W/"056f26f774245e913872879340e8dd36"
90
+ cache-control:
91
+ - max-age=0, private, must-revalidate
92
+ x-request-id:
93
+ - b3bc5b32-a587-49e8-8588-a54b9fa048a2
94
+ x-runtime:
95
+ - '0.295099'
96
+ strict-transport-security:
97
+ - max-age=15768000
98
+ body:
99
+ encoding: UTF-8
100
+ string: '{"uuid":"cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33","external_id":"test_cus_ext_id","name":"Test
101
+ Customer","company":"","email":"","city":"","state":"","country":"","zip":"","data_source_uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6"}'
102
+ http_version:
103
+ recorded_at: Thu, 23 Jun 2016 20:46:06 GMT
104
+ - request:
105
+ method: post
106
+ uri: https://api.chartmogul.com/v1/import/plans
107
+ body:
108
+ encoding: UTF-8
109
+ string: '{"data_source_uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6","name":"Test
110
+ Plan","interval_count":7,"interval_unit":"day"}'
111
+ headers:
112
+ User-Agent:
113
+ - Faraday v0.9.2
114
+ Content-Type:
115
+ - application/json
116
+ Authorization:
117
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
118
+ response:
119
+ status:
120
+ code: 201
121
+ message:
122
+ headers:
123
+ server:
124
+ - nginx/1.9.10
125
+ date:
126
+ - Thu, 23 Jun 2016 20:46:06 GMT
127
+ content-type:
128
+ - application/json; charset=utf-8
129
+ transfer-encoding:
130
+ - chunked
131
+ connection:
132
+ - close
133
+ x-frame-options:
134
+ - SAMEORIGIN
135
+ x-xss-protection:
136
+ - 1; mode=block
137
+ x-content-type-options:
138
+ - nosniff
139
+ etag:
140
+ - W/"cc9005f2d9ac2dcb5fb9076128a32d21"
141
+ cache-control:
142
+ - max-age=0, private, must-revalidate
143
+ x-request-id:
144
+ - 250b3ffc-64f6-482a-a395-1f46b7cf3736
145
+ x-runtime:
146
+ - '0.025146'
147
+ strict-transport-security:
148
+ - max-age=15768000
149
+ body:
150
+ encoding: UTF-8
151
+ string: '{"uuid":"pl_06ea83a9-f8c8-4ddd-a980-9ceffd27f107","external_id":null,"name":"Test
152
+ Plan","interval_count":7,"interval_unit":"day","data_source_uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6"}'
153
+ http_version:
154
+ recorded_at: Thu, 23 Jun 2016 20:46:06 GMT
155
+ - request:
156
+ method: post
157
+ uri: https://api.chartmogul.com/v1/import/customers/cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33/invoices
158
+ body:
159
+ encoding: UTF-8
160
+ string: '{"invoices":[{"date":"2016-01-01 12:00:00 +0000","currency":"USD","line_items":[{"type":"subscription","subscription_external_id":"test_cus_sub_ext_id","plan_uuid":"pl_06ea83a9-f8c8-4ddd-a980-9ceffd27f107","service_period_start":"2016-01-01
161
+ 12:00:00 +0000","service_period_end":"2016-02-01 12:00:00 +0000","amount_in_cents":1000}],"external_id":"test_tr_inv_ext_id"}],"customer_uuid":"cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33"}'
162
+ headers:
163
+ User-Agent:
164
+ - Faraday v0.9.2
165
+ Content-Type:
166
+ - application/json
167
+ Authorization:
168
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
169
+ response:
170
+ status:
171
+ code: 201
172
+ message:
173
+ headers:
174
+ server:
175
+ - nginx/1.9.10
176
+ date:
177
+ - Thu, 23 Jun 2016 20:46:07 GMT
178
+ content-type:
179
+ - application/json; charset=utf-8
180
+ transfer-encoding:
181
+ - chunked
182
+ connection:
183
+ - close
184
+ x-frame-options:
185
+ - SAMEORIGIN
186
+ x-xss-protection:
187
+ - 1; mode=block
188
+ x-content-type-options:
189
+ - nosniff
190
+ etag:
191
+ - W/"25c93d56164e8f1515058dc7f3a0d468"
192
+ cache-control:
193
+ - max-age=0, private, must-revalidate
194
+ x-request-id:
195
+ - 72edbe3a-c00c-4d83-80ca-8e091784fa88
196
+ x-runtime:
197
+ - '0.095619'
198
+ strict-transport-security:
199
+ - max-age=15768000
200
+ body:
201
+ encoding: UTF-8
202
+ string: '{"invoices":[{"uuid":"inv_90054098-c269-46e1-b69a-338a8216499a","external_id":"test_tr_inv_ext_id","date":"2016-01-01T12:00:00.000Z","due_date":null,"currency":"USD","line_items":[{"uuid":"li_d25c8f7f-a10a-445f-9793-b7c68bd699cd","external_id":null,"type":"subscription","subscription_uuid":"sub_9b3ccf25-4613-4af6-84b3-12026cfa4b7c","plan_uuid":"pl_06ea83a9-f8c8-4ddd-a980-9ceffd27f107","prorated":false,"service_period_start":"2016-01-01T12:00:00.000Z","service_period_end":"2016-02-01T12:00:00.000Z","amount_in_cents":1000,"quantity":1,"discount_code":"","discount_amount_in_cents":0,"tax_amount_in_cents":0}],"transactions":[]}]}'
203
+ http_version:
204
+ recorded_at: Thu, 23 Jun 2016 20:46:07 GMT
205
+ - request:
206
+ method: get
207
+ uri: https://api.chartmogul.com/v1/import/customers/cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33/subscriptions
208
+ body:
209
+ encoding: US-ASCII
210
+ string: ''
211
+ headers:
212
+ User-Agent:
213
+ - Faraday v0.9.2
214
+ Content-Type:
215
+ - application/json
216
+ Authorization:
217
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
218
+ response:
219
+ status:
220
+ code: 200
221
+ message:
222
+ headers:
223
+ server:
224
+ - nginx/1.9.10
225
+ date:
226
+ - Thu, 23 Jun 2016 20:46:07 GMT
227
+ content-type:
228
+ - application/json; charset=utf-8
229
+ transfer-encoding:
230
+ - chunked
231
+ connection:
232
+ - close
233
+ x-frame-options:
234
+ - SAMEORIGIN
235
+ x-xss-protection:
236
+ - 1; mode=block
237
+ x-content-type-options:
238
+ - nosniff
239
+ etag:
240
+ - W/"797037ae5a33dcae7de46e23dfdd4ec7"
241
+ cache-control:
242
+ - max-age=0, private, must-revalidate
243
+ x-request-id:
244
+ - efa1a67e-37e8-4ac3-bce7-8d11f33d0e8c
245
+ x-runtime:
246
+ - '0.026716'
247
+ strict-transport-security:
248
+ - max-age=15768000
249
+ body:
250
+ encoding: UTF-8
251
+ string: '{"customer_uuid":"cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33","subscriptions":[{"uuid":"sub_9b3ccf25-4613-4af6-84b3-12026cfa4b7c","external_id":"test_cus_sub_ext_id","cancellation_dates":[],"plan_uuid":"pl_06ea83a9-f8c8-4ddd-a980-9ceffd27f107","data_source_uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6"}],"current_page":1,"total_pages":1}'
252
+ http_version:
253
+ recorded_at: Thu, 23 Jun 2016 20:46:07 GMT
254
+ - request:
255
+ method: patch
256
+ uri: https://api.chartmogul.com/v1/import/subscriptions/sub_9b3ccf25-4613-4af6-84b3-12026cfa4b7c
257
+ body:
258
+ encoding: UTF-8
259
+ string: '{"cancelled_at":"2016-01-15 12:00:00 +0000"}'
260
+ headers:
261
+ User-Agent:
262
+ - Faraday v0.9.2
263
+ Content-Type:
264
+ - application/json
265
+ Authorization:
266
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
267
+ response:
268
+ status:
269
+ code: 202
270
+ message:
271
+ headers:
272
+ server:
273
+ - nginx/1.9.10
274
+ date:
275
+ - Thu, 23 Jun 2016 20:46:07 GMT
276
+ content-type:
277
+ - application/json; charset=utf-8
278
+ transfer-encoding:
279
+ - chunked
280
+ connection:
281
+ - close
282
+ x-frame-options:
283
+ - SAMEORIGIN
284
+ x-xss-protection:
285
+ - 1; mode=block
286
+ x-content-type-options:
287
+ - nosniff
288
+ cache-control:
289
+ - no-cache
290
+ x-request-id:
291
+ - 7bdf7b19-3d18-481a-9f12-e3f613b50f7b
292
+ x-runtime:
293
+ - '0.060122'
294
+ body:
295
+ encoding: UTF-8
296
+ string: '{"uuid":"sub_9b3ccf25-4613-4af6-84b3-12026cfa4b7c","external_id":"test_cus_sub_ext_id","cancellation_dates":["2016-01-15T12:00:00.000Z"],"customer_uuid":"cus_510b1395-4fe8-4d35-ae23-0e61f9a51e33","plan_uuid":"pl_06ea83a9-f8c8-4ddd-a980-9ceffd27f107","data_source_uuid":"ds_55ab11fb-53e6-4468-aa95-bd582f14cac6"}'
297
+ http_version:
298
+ recorded_at: Thu, 23 Jun 2016 20:46:07 GMT
299
+ - request:
300
+ method: delete
301
+ uri: https://api.chartmogul.com/v1/import/data_sources/ds_55ab11fb-53e6-4468-aa95-bd582f14cac6
302
+ body:
303
+ encoding: US-ASCII
304
+ string: ''
305
+ headers:
306
+ User-Agent:
307
+ - Faraday v0.9.2
308
+ Authorization:
309
+ - Basic YmIzN2I0Njk5NjNlMjhlYjY2MjA1ZWYzZmU1MWQ1NmM6ZmM1YjQxYzM3YTNlZTcwYjQyN2UwYzU1ODg2NzA2ZmQ=
310
+ response:
311
+ status:
312
+ code: 204
313
+ message:
314
+ headers:
315
+ server:
316
+ - nginx/1.9.10
317
+ date:
318
+ - Thu, 23 Jun 2016 20:46:07 GMT
319
+ connection:
320
+ - close
321
+ x-frame-options:
322
+ - SAMEORIGIN
323
+ x-xss-protection:
324
+ - 1; mode=block
325
+ x-content-type-options:
326
+ - nosniff
327
+ cache-control:
328
+ - no-cache
329
+ x-request-id:
330
+ - ebf1f856-a389-457f-aead-22769e35aa8e
331
+ x-runtime:
332
+ - '0.013399'
333
+ strict-transport-security:
334
+ - max-age=15768000
335
+ body:
336
+ encoding: UTF-8
337
+ string: ''
338
+ http_version:
339
+ recorded_at: Thu, 23 Jun 2016 20:46:07 GMT
340
+ recorded_with: VCR 3.0.3