chartmogul-ruby 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +10 -10
- data/.rspec +2 -2
- data/.travis.yml +4 -4
- data/Gemfile +4 -4
- data/LICENSE.txt +21 -21
- data/README.md +111 -111
- data/Rakefile +6 -6
- data/bin/console +14 -14
- data/bin/setup +9 -9
- data/changelog.md +27 -27
- data/chartmogul-ruby.gemspec +29 -29
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_custom_attributes.yml +80 -80
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/adds_required_tags.yml +79 -79
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/can_page_through_search_endpoint.yml +43 -43
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_handles_a_422_response.yml +50 -50
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/correctly_interracts_with_the_API.yml +244 -244
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/merges_customers.yml +185 -185
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_401_if_invalid_credentials.yml +38 -38
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_404_if_no_customers_found.yml +38 -38
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/raises_422_for_update_with_invalid_data.yml +86 -86
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/removes_custom_attributes.yml +80 -80
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/removes_tags.yml +80 -80
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_all_customers_through_list_all_endpoint.yml +47 -47
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_customer_through_retrieve_endpoint.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/returns_right_customers_through_search_endpoint.yml +43 -43
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_custom_attributes.yml +82 -82
- data/fixtures/vcr_cassettes/ChartMogul_Customer/API_Interactions/updates_customer.yml +139 -139
- data/fixtures/vcr_cassettes/ChartMogul_Customer/_find_by_external_id/when_external_id_is_provided/returns_matching_user_if_exists.yml +102 -102
- data/fixtures/vcr_cassettes/ChartMogul_Customer/_find_by_external_id/when_external_id_is_provided/returns_nil_if_customer_does_not_exist.yml +101 -101
- data/fixtures/vcr_cassettes/ChartMogul_CustomerInvoices/API_Interactions/correctly_interracts_with_the_API.yml +298 -298
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_interracts_with_the_API.yml +189 -189
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_404.yml +46 -46
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/correctly_raises_errors_on_422.yml +48 -48
- data/fixtures/vcr_cassettes/ChartMogul_DataSource/API_Interactions/retrieves_existing_data_source_matching_uuid.yml +101 -101
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/deletes_an_invoice.yml +37 -0
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/deletes_an_invoice_with_class_method.yml +37 -0
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/raises_error_on_deleting_non-existing_invoice.yml +42 -0
- data/fixtures/vcr_cassettes/ChartMogul_Invoice/API_Interactions/returns_all_invoices_through_list_all_endpoint.yml +46 -46
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARPA/behaves_like_Metrics_API_resource/should_have_entries.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/should_have_entries.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/behaves_like_Pageable/should_be_pageable.yml +41 -41
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/should_have_Activity_entries.yml +41 -41
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_AllKeyMetric/should_have_entries.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/should_have_entries.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/behaves_like_Summary/should_have_summary.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/should_have_entries.yml +42 -42
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Subscription/behaves_like_Pageable/should_be_pageable.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Subscription/should_have_Subscription_entries.yml +40 -40
- data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_on_incorrect_credentials.yml +38 -38
- data/fixtures/vcr_cassettes/ChartMogul_Ping/pings/when_credentials_correct.yml +38 -38
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/correctly_handles_a_422_error.yml +51 -51
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/correctly_interacts_with_the_API.yml +152 -152
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/deletes_existing_plan.yml +198 -198
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/retrieves_existing_plan_by_uuid.yml +151 -151
- data/fixtures/vcr_cassettes/ChartMogul_Plan/API_Interactions/updates_existing_plan.yml +198 -198
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/correctly_interracts_with_the_API.yml +340 -340
- data/fixtures/vcr_cassettes/ChartMogul_Subscription/API_Interactions/has_multiple_aliases.yml +101 -101
- data/fixtures/vcr_cassettes/ChartMogul_Transactions_Payment/API_Interactions/correctly_interracts_with_the_API.yml +243 -243
- data/lib/chartmogul.rb +79 -79
- data/lib/chartmogul/api/actions/all.rb +23 -23
- data/lib/chartmogul/api/actions/create.rb +39 -39
- data/lib/chartmogul/api/actions/custom.rb +37 -37
- data/lib/chartmogul/api/actions/destroy.rb +28 -14
- data/lib/chartmogul/api/actions/update.rb +19 -19
- data/lib/chartmogul/api_resource.rb +68 -68
- data/lib/chartmogul/concerns/entries.rb +39 -39
- data/lib/chartmogul/concerns/pageable.rb +13 -13
- data/lib/chartmogul/concerns/pageable2.rb +12 -12
- data/lib/chartmogul/concerns/summary.rb +20 -20
- data/lib/chartmogul/config_attributes.rb +15 -15
- data/lib/chartmogul/configuration.rb +6 -6
- data/lib/chartmogul/customer.rb +155 -155
- data/lib/chartmogul/customer_invoices.rb +44 -44
- data/lib/chartmogul/data_source.rb +38 -38
- data/lib/chartmogul/enrichment/customer.rb +141 -141
- data/lib/chartmogul/errors/chartmogul_error.rb +19 -19
- data/lib/chartmogul/errors/configuration_error.rb +4 -4
- data/lib/chartmogul/errors/forbidden_error.rb +4 -4
- data/lib/chartmogul/errors/not_found_error.rb +4 -4
- data/lib/chartmogul/errors/resource_invalid_error.rb +4 -4
- data/lib/chartmogul/errors/schema_invalid_error.rb +4 -4
- data/lib/chartmogul/errors/unauthorized_error.rb +4 -4
- data/lib/chartmogul/invoice.rb +83 -78
- data/lib/chartmogul/line_items/one_time.rb +23 -23
- data/lib/chartmogul/line_items/subscription.rb +29 -29
- data/lib/chartmogul/metrics/activity.rb +34 -34
- data/lib/chartmogul/metrics/all_key_metrics.rb +25 -25
- data/lib/chartmogul/metrics/arpa.rb +19 -19
- data/lib/chartmogul/metrics/arr.rb +19 -19
- data/lib/chartmogul/metrics/asp.rb +19 -19
- data/lib/chartmogul/metrics/base.rb +56 -56
- data/lib/chartmogul/metrics/customer_churn_rate.rb +19 -19
- data/lib/chartmogul/metrics/customer_count.rb +19 -19
- data/lib/chartmogul/metrics/ltv.rb +19 -19
- data/lib/chartmogul/metrics/mrr.rb +26 -26
- data/lib/chartmogul/metrics/mrr_churn_rate.rb +19 -19
- data/lib/chartmogul/metrics/subscription.rb +37 -37
- data/lib/chartmogul/object.rb +119 -119
- data/lib/chartmogul/ping.rb +14 -14
- data/lib/chartmogul/plan.rb +41 -41
- data/lib/chartmogul/resource_path.rb +42 -42
- data/lib/chartmogul/subscription.rb +48 -48
- data/lib/chartmogul/summary.rb +7 -7
- data/lib/chartmogul/transactions/payment.rb +24 -24
- data/lib/chartmogul/transactions/refund.rb +24 -24
- data/lib/chartmogul/utils/hash_snake_caser.rb +50 -50
- data/lib/chartmogul/utils/json_parser.rb +11 -11
- data/lib/chartmogul/version.rb +3 -3
- 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: 7fda69081fb6b26fff7aaf96fdf8e71f65796deb
|
4
|
+
data.tar.gz: 802863c7611016b04f05b4ea332d1af03d82f391
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 35626f843812477258ee1324cc044049dab1b0637b36a21f5f7b0274e641eabde498a9f41ec393134e1ee77e9f5634589b50c888e8e07302e3c16838b80c60de
|
7
|
+
data.tar.gz: 454e9c4772d53d9cc914584345adc98ce046d8946350f74e6856f78de8dfb65c040a78283276a824385bac8b0a4b4e9f1ffc98ee4af7624900a1e3fb2d6f643a
|
data/.gitignore
CHANGED
@@ -1,10 +1,10 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/Gemfile.lock
|
4
|
-
/_yardoc/
|
5
|
-
/coverage/
|
6
|
-
/doc/
|
7
|
-
/pkg/
|
8
|
-
/spec/reports/
|
9
|
-
/tmp/
|
10
|
-
*.swp
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/Gemfile.lock
|
4
|
+
/_yardoc/
|
5
|
+
/coverage/
|
6
|
+
/doc/
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/tmp/
|
10
|
+
*.swp
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format documentation
|
2
|
-
--color
|
1
|
+
--format documentation
|
2
|
+
--color
|
data/.travis.yml
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.3.0
|
4
|
-
before_install: gem install bundler
|
1
|
+
language: ruby
|
2
|
+
rvm:
|
3
|
+
- 2.3.0
|
4
|
+
before_install: gem install bundler
|
data/Gemfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in chartmogul-ruby.gemspec
|
4
|
-
gemspec
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in chartmogul-ruby.gemspec
|
4
|
+
gemspec
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 ChartMogul Ltd
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 ChartMogul Ltd
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,111 +1,111 @@
|
|
1
|
-
<p align="center">
|
2
|
-
<a href="https://chartmogul.com"><img width="200" src="https://chartmogul.com/assets/img/logo.png"></a>
|
3
|
-
</p>
|
4
|
-
|
5
|
-
<h3 align="center">Official ChartMogul API Ruby Client</h3>
|
6
|
-
|
7
|
-
<p align="center"><code>chartmogul-ruby</code> provides convenient Ruby bindings for <a href="https://dev.chartmogul.com">ChartMogul's API</a>.</p>
|
8
|
-
|
9
|
-
<p align="center">
|
10
|
-
<a href="https://badge.fury.io/rb/chartmogul-ruby"><img src="https://badge.fury.io/rb/chartmogul-ruby.svg" alt="Gem Version"></a>
|
11
|
-
<a href="https://travis-ci.org/chartmogul/chartmogul-ruby"><img src="https://travis-ci.org/chartmogul/chartmogul-ruby.svg?branch=master" alt="Travis project"></a>
|
12
|
-
</p>
|
13
|
-
|
14
|
-
<hr>
|
15
|
-
|
16
|
-
<p align="center">
|
17
|
-
<b><a href="#installation">Installation</a></b>
|
18
|
-
|
|
19
|
-
<b><a href="#configuration">Configuration</a></b>
|
20
|
-
|
|
21
|
-
<b><a href="#usage">Usage</a></b>
|
22
|
-
|
|
23
|
-
<b><a href="#development">Development</a></b>
|
24
|
-
|
|
25
|
-
<b><a href="#contributing">Contributing</a></b>
|
26
|
-
|
|
27
|
-
<b><a href="#license">License</a></b>
|
28
|
-
</p>
|
29
|
-
|
30
|
-
<hr>
|
31
|
-
<br>
|
32
|
-
|
33
|
-
|
34
|
-
## Installation
|
35
|
-
|
36
|
-
Add this line to your application's Gemfile:
|
37
|
-
|
38
|
-
```ruby
|
39
|
-
gem 'chartmogul-ruby', require: 'chartmogul'
|
40
|
-
```
|
41
|
-
|
42
|
-
And then execute:
|
43
|
-
|
44
|
-
$ bundle
|
45
|
-
|
46
|
-
Or install it yourself as:
|
47
|
-
|
48
|
-
$ gem install chartmogul-ruby
|
49
|
-
|
50
|
-
## Configuration
|
51
|
-
|
52
|
-
Configure `chartmogul-ruby` with your Account Token and Secret Key, available from the administration section of your ChartMogul account.
|
53
|
-
|
54
|
-
```ruby
|
55
|
-
ChartMogul.account_token = '<Account key goes here>'
|
56
|
-
ChartMogul.secret_key = '<Secret key goes here>'
|
57
|
-
```
|
58
|
-
|
59
|
-
Test your authentication:
|
60
|
-
```ruby
|
61
|
-
ChartMogul::Ping.ping
|
62
|
-
```
|
63
|
-
|
64
|
-
## Usage
|
65
|
-
|
66
|
-
For example, to create a Data Source object,
|
67
|
-
|
68
|
-
Request:
|
69
|
-
```ruby
|
70
|
-
ChartMogul::DataSource.create!(
|
71
|
-
name: 'In-house billing'
|
72
|
-
)
|
73
|
-
```
|
74
|
-
|
75
|
-
Response:
|
76
|
-
```ruby
|
77
|
-
#<ChartMogul::DataSource:0x007ff9f127d628
|
78
|
-
@name="In-house billing",
|
79
|
-
@uuid="ds_cfc2b8f2-ad2c-4e3d-b64f-58d0bb282824",
|
80
|
-
@status="never_imported",
|
81
|
-
@created_at=2016-06-27 11:27:37 UTC
|
82
|
-
>
|
83
|
-
```
|
84
|
-
|
85
|
-
You can find examples for each endpoint in the ChartMogul [API documentation](https://dev.chartmogul.com/).
|
86
|
-
|
87
|
-
[![https://gyazo.com/f7a2a1b86a409586ee8dd0f4f7563937](https://i.gyazo.com/f7a2a1b86a409586ee8dd0f4f7563937.gif)](https://i.gyazo.com/f7a2a1b86a409586ee8dd0f4f7563937.gif)
|
88
|
-
|
89
|
-
## Development
|
90
|
-
|
91
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
92
|
-
|
93
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
94
|
-
|
95
|
-
## Contributing
|
96
|
-
|
97
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/chartmogul/chartmogul-ruby.
|
98
|
-
|
99
|
-
## License
|
100
|
-
|
101
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
102
|
-
|
103
|
-
### The MIT License (MIT)
|
104
|
-
|
105
|
-
*Copyright (c) 2016 ChartMogul Ltd.*
|
106
|
-
|
107
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
108
|
-
|
109
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
110
|
-
|
111
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
1
|
+
<p align="center">
|
2
|
+
<a href="https://chartmogul.com"><img width="200" src="https://chartmogul.com/assets/img/logo.png"></a>
|
3
|
+
</p>
|
4
|
+
|
5
|
+
<h3 align="center">Official ChartMogul API Ruby Client</h3>
|
6
|
+
|
7
|
+
<p align="center"><code>chartmogul-ruby</code> provides convenient Ruby bindings for <a href="https://dev.chartmogul.com">ChartMogul's API</a>.</p>
|
8
|
+
|
9
|
+
<p align="center">
|
10
|
+
<a href="https://badge.fury.io/rb/chartmogul-ruby"><img src="https://badge.fury.io/rb/chartmogul-ruby.svg" alt="Gem Version"></a>
|
11
|
+
<a href="https://travis-ci.org/chartmogul/chartmogul-ruby"><img src="https://travis-ci.org/chartmogul/chartmogul-ruby.svg?branch=master" alt="Travis project"></a>
|
12
|
+
</p>
|
13
|
+
|
14
|
+
<hr>
|
15
|
+
|
16
|
+
<p align="center">
|
17
|
+
<b><a href="#installation">Installation</a></b>
|
18
|
+
|
|
19
|
+
<b><a href="#configuration">Configuration</a></b>
|
20
|
+
|
|
21
|
+
<b><a href="#usage">Usage</a></b>
|
22
|
+
|
|
23
|
+
<b><a href="#development">Development</a></b>
|
24
|
+
|
|
25
|
+
<b><a href="#contributing">Contributing</a></b>
|
26
|
+
|
|
27
|
+
<b><a href="#license">License</a></b>
|
28
|
+
</p>
|
29
|
+
|
30
|
+
<hr>
|
31
|
+
<br>
|
32
|
+
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
Add this line to your application's Gemfile:
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
gem 'chartmogul-ruby', require: 'chartmogul'
|
40
|
+
```
|
41
|
+
|
42
|
+
And then execute:
|
43
|
+
|
44
|
+
$ bundle
|
45
|
+
|
46
|
+
Or install it yourself as:
|
47
|
+
|
48
|
+
$ gem install chartmogul-ruby
|
49
|
+
|
50
|
+
## Configuration
|
51
|
+
|
52
|
+
Configure `chartmogul-ruby` with your Account Token and Secret Key, available from the administration section of your ChartMogul account.
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
ChartMogul.account_token = '<Account key goes here>'
|
56
|
+
ChartMogul.secret_key = '<Secret key goes here>'
|
57
|
+
```
|
58
|
+
|
59
|
+
Test your authentication:
|
60
|
+
```ruby
|
61
|
+
ChartMogul::Ping.ping
|
62
|
+
```
|
63
|
+
|
64
|
+
## Usage
|
65
|
+
|
66
|
+
For example, to create a Data Source object,
|
67
|
+
|
68
|
+
Request:
|
69
|
+
```ruby
|
70
|
+
ChartMogul::DataSource.create!(
|
71
|
+
name: 'In-house billing'
|
72
|
+
)
|
73
|
+
```
|
74
|
+
|
75
|
+
Response:
|
76
|
+
```ruby
|
77
|
+
#<ChartMogul::DataSource:0x007ff9f127d628
|
78
|
+
@name="In-house billing",
|
79
|
+
@uuid="ds_cfc2b8f2-ad2c-4e3d-b64f-58d0bb282824",
|
80
|
+
@status="never_imported",
|
81
|
+
@created_at=2016-06-27 11:27:37 UTC
|
82
|
+
>
|
83
|
+
```
|
84
|
+
|
85
|
+
You can find examples for each endpoint in the ChartMogul [API documentation](https://dev.chartmogul.com/).
|
86
|
+
|
87
|
+
[![https://gyazo.com/f7a2a1b86a409586ee8dd0f4f7563937](https://i.gyazo.com/f7a2a1b86a409586ee8dd0f4f7563937.gif)](https://i.gyazo.com/f7a2a1b86a409586ee8dd0f4f7563937.gif)
|
88
|
+
|
89
|
+
## Development
|
90
|
+
|
91
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
92
|
+
|
93
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/chartmogul/chartmogul-ruby.
|
98
|
+
|
99
|
+
## License
|
100
|
+
|
101
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
102
|
+
|
103
|
+
### The MIT License (MIT)
|
104
|
+
|
105
|
+
*Copyright (c) 2016 ChartMogul Ltd.*
|
106
|
+
|
107
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
108
|
+
|
109
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
110
|
+
|
111
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rspec/core/rake_task"
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec)
|
5
|
-
|
6
|
-
task :default => :spec
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rspec/core/rake_task"
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec)
|
5
|
+
|
6
|
+
task :default => :spec
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "chartmogul"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "chartmogul"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
gem install bundler
|
7
|
-
bundle install
|
8
|
-
|
9
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
gem install bundler
|
7
|
+
bundle install
|
8
|
+
|
9
|
+
# Do any other automated setup that you need to do here
|
data/changelog.md
CHANGED
@@ -1,27 +1,27 @@
|
|
1
|
-
# chartmogul-ruby Change Log
|
2
|
-
|
3
|
-
## Version 1.0.2 - 6 March 2017
|
4
|
-
- Consolidated Customer, Enrichment/Customer now deprecated
|
5
|
-
|
6
|
-
## Version 1.0.1 - 21 February 2017
|
7
|
-
- Fixed all() in Customer, now returns Customers with paging
|
8
|
-
|
9
|
-
## Version 1.0.0 - 14 February 2017
|
10
|
-
- Add support for new plan and data source endpoints
|
11
|
-
- Remove deprecated Import namespace
|
12
|
-
|
13
|
-
## Version 0.1.4 - 10 November 2016
|
14
|
-
- Add support for merging customers
|
15
|
-
- Add support for updating customers
|
16
|
-
|
17
|
-
## Version 0.1.3 - 8 November 2016
|
18
|
-
- Add support for lead_created_at and free_trial_started_at fields to work with Leads and Trials charts
|
19
|
-
|
20
|
-
## Version 0.1.2 - 13 July 2016
|
21
|
-
- Fix bug preventing cancellation of subscriptions [#22]
|
22
|
-
|
23
|
-
## Version 0.1.1 - 4 July 2016
|
24
|
-
- Version bump after 0.1.0 pushed to RubyGems under incorrect account.
|
25
|
-
|
26
|
-
## Version 0.1.0 - 4 July 2016
|
27
|
-
- Initial release with support for our Import, Enrichment and Metrics APIs.
|
1
|
+
# chartmogul-ruby Change Log
|
2
|
+
|
3
|
+
## Version 1.0.2 - 6 March 2017
|
4
|
+
- Consolidated Customer, Enrichment/Customer now deprecated
|
5
|
+
|
6
|
+
## Version 1.0.1 - 21 February 2017
|
7
|
+
- Fixed all() in Customer, now returns Customers with paging
|
8
|
+
|
9
|
+
## Version 1.0.0 - 14 February 2017
|
10
|
+
- Add support for new plan and data source endpoints
|
11
|
+
- Remove deprecated Import namespace
|
12
|
+
|
13
|
+
## Version 0.1.4 - 10 November 2016
|
14
|
+
- Add support for merging customers
|
15
|
+
- Add support for updating customers
|
16
|
+
|
17
|
+
## Version 0.1.3 - 8 November 2016
|
18
|
+
- Add support for lead_created_at and free_trial_started_at fields to work with Leads and Trials charts
|
19
|
+
|
20
|
+
## Version 0.1.2 - 13 July 2016
|
21
|
+
- Fix bug preventing cancellation of subscriptions [#22]
|
22
|
+
|
23
|
+
## Version 0.1.1 - 4 July 2016
|
24
|
+
- Version bump after 0.1.0 pushed to RubyGems under incorrect account.
|
25
|
+
|
26
|
+
## Version 0.1.0 - 4 July 2016
|
27
|
+
- Initial release with support for our Import, Enrichment and Metrics APIs.
|
data/chartmogul-ruby.gemspec
CHANGED
@@ -1,29 +1,29 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'chartmogul/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = 'chartmogul-ruby'
|
8
|
-
spec.version = ChartMogul::VERSION
|
9
|
-
spec.authors = ['Jason Langenauer']
|
10
|
-
spec.email = ['jason@chartmogul.com']
|
11
|
-
|
12
|
-
spec.summary = 'Chartmogul API Ruby Client'
|
13
|
-
spec.description = 'Official Ruby client for ChartMogul\'s API'
|
14
|
-
spec.homepage = 'https://github.com/chartmogul/chartmogul-ruby'
|
15
|
-
spec.license = 'MIT'
|
16
|
-
|
17
|
-
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
-
spec.bindir = 'exe'
|
19
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.add_dependency 'faraday', '~>0.9'
|
23
|
-
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1.11'
|
25
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
-
spec.add_development_dependency 'vcr', '~> 3.0'
|
28
|
-
spec.add_development_dependency 'pry', '~> 0.10.3'
|
29
|
-
end
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'chartmogul/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'chartmogul-ruby'
|
8
|
+
spec.version = ChartMogul::VERSION
|
9
|
+
spec.authors = ['Jason Langenauer']
|
10
|
+
spec.email = ['jason@chartmogul.com']
|
11
|
+
|
12
|
+
spec.summary = 'Chartmogul API Ruby Client'
|
13
|
+
spec.description = 'Official Ruby client for ChartMogul\'s API'
|
14
|
+
spec.homepage = 'https://github.com/chartmogul/chartmogul-ruby'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = 'exe'
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'faraday', '~>0.9'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.11'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
27
|
+
spec.add_development_dependency 'vcr', '~> 3.0'
|
28
|
+
spec.add_development_dependency 'pry', '~> 0.10.3'
|
29
|
+
end
|