chartmogul-ruby 1.7.3 → 2.0.0
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.
- checksums.yaml +4 -4
- data/.github/workflows/test.yml +44 -0
- data/2.0-Upgrade.md +9 -0
- data/README.md +0 -1
- data/changelog.md +4 -0
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity.yml +37 -0
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/behaves_like_PageableWithAnchor/should_be_pageable.yml +44 -0
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/should_have_Activity_entries.yml +17 -14
- data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Activity → ChartMogul_Metrics_Customers_Activity}/behaves_like_Pageable/should_be_pageable.yml +0 -0
- data/fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Activity/should_have_Activity_entries.yml +41 -0
- data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Subscription → ChartMogul_Metrics_Customers_Subscription}/behaves_like_Pageable/should_be_pageable.yml +0 -0
- data/fixtures/vcr_cassettes/{ChartMogul_Metrics_Subscription → ChartMogul_Metrics_Customers_Subscription}/should_have_Subscription_entries.yml +0 -0
- data/lib/chartmogul.rb +3 -1
- data/lib/chartmogul/concerns/pageable_with_anchor.rb +14 -0
- data/lib/chartmogul/metrics/activity.rb +12 -8
- data/lib/chartmogul/metrics/customers/activity.rb +38 -0
- data/lib/chartmogul/metrics/customers/subscription.rb +41 -0
- data/lib/chartmogul/version.rb +1 -1
- metadata +13 -7
- data/.travis.yml +0 -25
- data/lib/chartmogul/metrics/subscription.rb +0 -39
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b36660d2c3b0a96c64043db0972df8d4e175a0c5aa16207205af589b0c1519
|
4
|
+
data.tar.gz: d94893728579c81658b93a79dad253806bb98021f6ccc5eb124d81452c2f621b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34f57b3c3eda27f75c710c2d38c1b95fe66caa726e401d700a42dfbd4c75f54c4bbf7c9fd31768e8478d59663518a340d42e34592890ad088323a0e0a031ad84
|
7
|
+
data.tar.gz: e9e2bcc3fa435cfe8f924673db791ffda6c5dc3da740eee2b9b4118dc025ce2c3fb10ceff8d2383db1acb255a039f9ecbbeda1dc457cae8b6329d6454107386f
|
@@ -0,0 +1,44 @@
|
|
1
|
+
name: Run specs and generate Code Climate report
|
2
|
+
on:
|
3
|
+
push:
|
4
|
+
branches: [ main ]
|
5
|
+
pull_request:
|
6
|
+
branches: [ main ]
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
matrix:
|
12
|
+
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7]
|
13
|
+
steps:
|
14
|
+
- uses: actions/checkout@v2
|
15
|
+
- name: Set up Ruby ${{ matrix.ruby-version }}
|
16
|
+
uses: ruby/setup-ruby@v1
|
17
|
+
with:
|
18
|
+
ruby-version: ${{ matrix.ruby-version }}
|
19
|
+
bundler-cache: true
|
20
|
+
- name: Install dependencies
|
21
|
+
run: bundle install
|
22
|
+
- name: Set ENV for codeclimate (pull_request)
|
23
|
+
run: |
|
24
|
+
git fetch --no-tags --prune --depth=1 origin +refs/heads/$GITHUB_HEAD_REF:refs/remotes/origin/$GITHUB_HEAD_REF
|
25
|
+
echo "GIT_BRANCH=$GITHUB_HEAD_REF" >> $GITHUB_ENV
|
26
|
+
echo "GIT_COMMIT_SHA=$(git rev-parse origin/$GITHUB_HEAD_REF)" >> $GITHUB_ENV
|
27
|
+
if: github.event_name == 'pull_request'
|
28
|
+
- name: Set ENV for codeclimate (push)
|
29
|
+
run: |
|
30
|
+
echo "GIT_BRANCH=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
|
31
|
+
echo "GIT_COMMIT_SHA=$GITHUB_SHA" >> $GITHUB_ENV
|
32
|
+
if: github.event_name == 'push'
|
33
|
+
- name: Install Code Climate test report
|
34
|
+
run: |
|
35
|
+
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
36
|
+
chmod +x ./cc-test-reporter
|
37
|
+
./cc-test-reporter before-build
|
38
|
+
- name: Run tests
|
39
|
+
run: bundle exec rake
|
40
|
+
- name: Send Report to Code Climate
|
41
|
+
env:
|
42
|
+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
|
43
|
+
if: ${{ success() }}
|
44
|
+
run: ./cc-test-reporter after-build
|
data/2.0-Upgrade.md
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# Upgrading to chartmogul-ruby 2.0.0
|
2
|
+
|
3
|
+
The gem upgrade brings breaking changes to the Metrics API. All other APIs remain unaffected. Please note the following changes:
|
4
|
+
|
5
|
+
* If you used the Metrics API to get a customer's activities or subscriptions, make the following changes in the namespace
|
6
|
+
- `ChartMogul::Metrics::Activity.all('cus_58c7d166-3bd1-4c10-948e-e68bb0fa2478')` should be replaced with `ChartMogul::Metrics::Customers::Activity.all('cus_58c7d166-3bd1-4c10-948e-e68bb0fa2478')`
|
7
|
+
- `ChartMogul::Metrics::Subscription.all('cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b')` should be replace with `ChartMogul::Metrics::Customers::Subscription.all('cus_3f6f53d3-bca7-4fcd-ad47-345180ef329b')`
|
8
|
+
|
9
|
+
|
data/README.md
CHANGED
@@ -8,7 +8,6 @@
|
|
8
8
|
|
9
9
|
<p align="center">
|
10
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=main" alt="Travis project"></a>
|
12
11
|
<a href="https://codeclimate.com/github/chartmogul/chartmogul-ruby/test_coverage"><img src="https://api.codeclimate.com/v1/badges/40e8bdff4d1dbf2451de/test_coverage" /></a>
|
13
12
|
</p>
|
14
13
|
|
data/changelog.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
# chartmogul-ruby Change Log
|
2
2
|
|
3
|
+
## Version 2.0.0 - 25 June 2021
|
4
|
+
- Moves customer scoped Metrics::Activities and Metrics::Subscriptions under Metrics::Customers namespace
|
5
|
+
- Adds unscoped activites API endpoint
|
6
|
+
|
3
7
|
## Version 1.7.2 - 16 March 2021
|
4
8
|
- Fix bug preventing instantiating attributes on ChartMogul::Customers objects
|
5
9
|
|
@@ -0,0 +1,37 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/activities
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v1.0.1
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 401
|
19
|
+
message: Unauthorized
|
20
|
+
headers:
|
21
|
+
server:
|
22
|
+
- nginx/1.10.1
|
23
|
+
date:
|
24
|
+
- Fri, 18 Jun 2021 10:37:37 GMT
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
status:
|
32
|
+
- 401 Unauthorized
|
33
|
+
body:
|
34
|
+
encoding: UTF-8
|
35
|
+
string: '{"code":401,"message":"No valid API key provided","param":null}'
|
36
|
+
recorded_at: Fri, 18 Jun 2021 10:37:37 GMT
|
37
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,44 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/activities?per_page=2
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v1.0.1
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message: OK
|
20
|
+
headers:
|
21
|
+
server:
|
22
|
+
- nginx/1.10.1
|
23
|
+
date:
|
24
|
+
- Fri, 18 Jun 2021 11:59:07 GMT
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
|
+
connection:
|
30
|
+
- keep-alive
|
31
|
+
vary:
|
32
|
+
- Accept-Encoding, Accept-Encoding
|
33
|
+
status:
|
34
|
+
- 200 OK
|
35
|
+
access-control-allow-credentials:
|
36
|
+
- 'true'
|
37
|
+
body:
|
38
|
+
encoding: ASCII-8BIT
|
39
|
+
string: '{"entries":[{"description":"purchased the Basic1 plan","activity-mrr-movement":4478,"activity-mrr":4478,"activity-arr":53736,"date":"2016-08-01T06:28:25+00:00","type":"new_biz","currency":"EUR","subscription-external-id":"si_18dZuXAN0YShtow4jjqxxNnW","plan-external-id":"a3e832e1-1bd1-4889-8466-8efdbfbdd94b","customer-name":"Customer
|
40
|
+
for test@example.com","customer-uuid":"6456e930-8c8e-11eb-a506-0ff43d2cc026","customer-external-id":"cus_8vQm8XjeEOw75p","billing-connector-uuid":"decdeb4c-8c8d-11eb-a506-b3974867f58c","uuid":"2f545d5f-f241-458c-8e99-38c0e5a6e6ff"},{"description":"purchased
|
41
|
+
the Basic1 plan","activity-mrr-movement":4425,"activity-mrr":4425,"activity-arr":53100,"date":"2016-08-17T09:28:10+00:00","type":"new_biz","currency":"EUR","subscription-external-id":"si_18jQLGAN0YShtow4kFWpOMVX","plan-external-id":"a3e832e1-1bd1-4889-8466-8efdbfbdd94b","customer-name":"Customer
|
42
|
+
for test@example.com","customer-uuid":"63ad1285-8c8e-11eb-a506-47d6b1cc7553","customer-external-id":"cus_91TH9rjhhYCpai","billing-connector-uuid":"decdeb4c-8c8d-11eb-a506-b3974867f58c","uuid":"9d5ba7fd-e06d-4750-a8f6-2983f3a30fb2"}],"has_more":true,"per_page":2}'
|
43
|
+
recorded_at: Fri, 18 Jun 2021 11:59:07 GMT
|
44
|
+
recorded_with: VCR 6.0.0
|
@@ -2,13 +2,13 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://api.chartmogul.com/v1/
|
5
|
+
uri: https://api.chartmogul.com/v1/activities?per_page=2
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
10
|
User-Agent:
|
11
|
-
- Faraday
|
11
|
+
- Faraday v1.0.1
|
12
12
|
Content-Type:
|
13
13
|
- application/json
|
14
14
|
Authorization:
|
@@ -16,26 +16,29 @@ http_interactions:
|
|
16
16
|
response:
|
17
17
|
status:
|
18
18
|
code: 200
|
19
|
-
message:
|
19
|
+
message: OK
|
20
20
|
headers:
|
21
21
|
server:
|
22
|
-
- nginx/1.
|
22
|
+
- nginx/1.10.1
|
23
23
|
date:
|
24
|
-
- Fri,
|
24
|
+
- Fri, 18 Jun 2021 11:59:07 GMT
|
25
25
|
content-type:
|
26
26
|
- application/json
|
27
|
-
|
28
|
-
-
|
27
|
+
transfer-encoding:
|
28
|
+
- chunked
|
29
29
|
connection:
|
30
|
-
-
|
30
|
+
- keep-alive
|
31
|
+
vary:
|
32
|
+
- Accept-Encoding, Accept-Encoding
|
31
33
|
status:
|
32
34
|
- 200 OK
|
33
35
|
access-control-allow-credentials:
|
34
36
|
- 'true'
|
35
37
|
body:
|
36
|
-
encoding:
|
37
|
-
string: '{"entries":[{"
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
38
|
+
encoding: ASCII-8BIT
|
39
|
+
string: '{"entries":[{"description":"purchased the Basic1 plan","activity-mrr-movement":4478,"activity-mrr":4478,"activity-arr":53736,"date":"2016-08-01T06:28:25+00:00","type":"new_biz","currency":"EUR","subscription-external-id":"si_18dZuXAN0YShtow4jjqxxNnW","plan-external-id":"a3e832e1-1bd1-4889-8466-8efdbfbdd94b","customer-name":"Customer
|
40
|
+
for test@example.com","customer-uuid":"6456e930-8c8e-11eb-a506-0ff43d2cc026","customer-external-id":"cus_8vQm8XjeEOw75p","billing-connector-uuid":"decdeb4c-8c8d-11eb-a506-b3974867f58c","uuid":"2f545d5f-f241-458c-8e99-38c0e5a6e6ff"},{"description":"purchased
|
41
|
+
the Basic1 plan","activity-mrr-movement":4425,"activity-mrr":4425,"activity-arr":53100,"date":"2016-08-17T09:28:10+00:00","type":"new_biz","currency":"EUR","subscription-external-id":"si_18jQLGAN0YShtow4kFWpOMVX","plan-external-id":"a3e832e1-1bd1-4889-8466-8efdbfbdd94b","customer-name":"Customer
|
42
|
+
for test@example.com","customer-uuid":"63ad1285-8c8e-11eb-a506-47d6b1cc7553","customer-external-id":"cus_91TH9rjhhYCpai","billing-connector-uuid":"decdeb4c-8c8d-11eb-a506-b3974867f58c","uuid":"9d5ba7fd-e06d-4750-a8f6-2983f3a30fb2"}],"has_more":true,"per_page":2}'
|
43
|
+
recorded_at: Fri, 18 Jun 2021 11:59:07 GMT
|
44
|
+
recorded_with: VCR 6.0.0
|
File without changes
|
data/fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Activity/should_have_Activity_entries.yml
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: get
|
5
|
+
uri: https://api.chartmogul.com/v1/customers/cus_91af761e-9d0a-11e5-b514-1feab446feac/activities
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: ''
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.2
|
12
|
+
Content-Type:
|
13
|
+
- application/json
|
14
|
+
Authorization:
|
15
|
+
- Basic hidden
|
16
|
+
response:
|
17
|
+
status:
|
18
|
+
code: 200
|
19
|
+
message:
|
20
|
+
headers:
|
21
|
+
server:
|
22
|
+
- nginx/1.9.10
|
23
|
+
date:
|
24
|
+
- Fri, 01 Jul 2016 14:47:49 GMT
|
25
|
+
content-type:
|
26
|
+
- application/json
|
27
|
+
content-length:
|
28
|
+
- '278'
|
29
|
+
connection:
|
30
|
+
- close
|
31
|
+
status:
|
32
|
+
- 200 OK
|
33
|
+
access-control-allow-credentials:
|
34
|
+
- 'true'
|
35
|
+
body:
|
36
|
+
encoding: UTF-8
|
37
|
+
string: '{"entries":[{"id":16664702,"description":"purchased the Yael Cohen
|
38
|
+
plan","activity-mrr-movement":10871,"activity-mrr":10871,"activity-arr":130452,"date":"2015-04-16T13:38:29+00:00","type":"new_biz","currency":"USD","currency-sign":"$","subscription_external_id":"si_IJxVS1c1TjSB0s"}],"has_more":false,"per_page":200,"page":1}'
|
39
|
+
http_version:
|
40
|
+
recorded_at: Fri, 01 Jul 2016 14:47:49 GMT
|
41
|
+
recorded_with: VCR 3.0.3
|
File without changes
|
File without changes
|
data/lib/chartmogul.rb
CHANGED
@@ -43,6 +43,7 @@ require 'chartmogul/concerns/entries'
|
|
43
43
|
require 'chartmogul/concerns/summary'
|
44
44
|
require 'chartmogul/concerns/pageable'
|
45
45
|
require 'chartmogul/concerns/pageable2'
|
46
|
+
require 'chartmogul/concerns/pageable_with_anchor'
|
46
47
|
|
47
48
|
require 'chartmogul/subscription'
|
48
49
|
require 'chartmogul/invoice'
|
@@ -66,8 +67,9 @@ require 'chartmogul/metrics/mrr_churn_rate'
|
|
66
67
|
require 'chartmogul/metrics/all_key_metrics'
|
67
68
|
require 'chartmogul/metrics/base'
|
68
69
|
|
70
|
+
require 'chartmogul/metrics/customers/activity'
|
71
|
+
require 'chartmogul/metrics/customers/subscription'
|
69
72
|
require 'chartmogul/metrics/activity'
|
70
|
-
require 'chartmogul/metrics/subscription'
|
71
73
|
|
72
74
|
require 'chartmogul/enrichment/customer'
|
73
75
|
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module ChartMogul
|
4
4
|
module Metrics
|
5
5
|
class Activity < ChartMogul::Object
|
6
|
-
readonly_attr :id
|
7
6
|
readonly_attr :description
|
8
7
|
readonly_attr :type
|
9
8
|
readonly_attr :date, type: :time
|
@@ -11,25 +10,30 @@ module ChartMogul
|
|
11
10
|
readonly_attr :activity_mrr
|
12
11
|
readonly_attr :activity_mrr_movement
|
13
12
|
readonly_attr :currency
|
14
|
-
readonly_attr :currency_sign
|
15
13
|
readonly_attr :subscription_external_id
|
14
|
+
readonly_attr :plan_external_id
|
15
|
+
readonly_attr :customer_name
|
16
|
+
readonly_attr :customer_uuid
|
17
|
+
readonly_attr :customer_external_id
|
18
|
+
readonly_attr :billing_connector_uuid
|
19
|
+
readonly_attr :uuid
|
16
20
|
|
17
|
-
def self.all(
|
18
|
-
ChartMogul::Metrics::Activities.all(
|
21
|
+
def self.all(options = {})
|
22
|
+
ChartMogul::Metrics::Activities.all(options)
|
19
23
|
end
|
20
24
|
end
|
21
25
|
|
22
26
|
class Activities < APIResource
|
23
27
|
set_resource_name 'Activities'
|
24
|
-
set_resource_path '/v1/
|
28
|
+
set_resource_path '/v1/activities'
|
25
29
|
|
26
30
|
include Concerns::Entries
|
27
|
-
include Concerns::
|
31
|
+
include Concerns::PageableWithAnchor
|
28
32
|
|
29
33
|
set_entry_class Activity
|
30
34
|
|
31
|
-
def self.all(
|
32
|
-
super(options
|
35
|
+
def self.all(options = {})
|
36
|
+
super(options)
|
33
37
|
end
|
34
38
|
end
|
35
39
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ChartMogul
|
4
|
+
module Metrics
|
5
|
+
module Customers
|
6
|
+
class Activity < ChartMogul::Object
|
7
|
+
readonly_attr :id
|
8
|
+
readonly_attr :description
|
9
|
+
readonly_attr :type
|
10
|
+
readonly_attr :date, type: :time
|
11
|
+
readonly_attr :activity_arr
|
12
|
+
readonly_attr :activity_mrr
|
13
|
+
readonly_attr :activity_mrr_movement
|
14
|
+
readonly_attr :currency
|
15
|
+
readonly_attr :currency_sign
|
16
|
+
readonly_attr :subscription_external_id
|
17
|
+
|
18
|
+
def self.all(customer_uuid, options = {})
|
19
|
+
ChartMogul::Metrics::Customers::Activities.all(customer_uuid, options)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Activities < APIResource
|
24
|
+
set_resource_name 'Activities'
|
25
|
+
set_resource_path '/v1/customers/:customer_uuid/activities'
|
26
|
+
|
27
|
+
include Concerns::Entries
|
28
|
+
include Concerns::Pageable
|
29
|
+
|
30
|
+
set_entry_class Activity
|
31
|
+
|
32
|
+
def self.all(customer_uuid, options = {})
|
33
|
+
super(options.merge(customer_uuid: customer_uuid))
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module ChartMogul
|
4
|
+
module Metrics
|
5
|
+
module Customers
|
6
|
+
class Subscription < ChartMogul::Object
|
7
|
+
readonly_attr :id
|
8
|
+
readonly_attr :external_id
|
9
|
+
readonly_attr :plan
|
10
|
+
readonly_attr :quantity
|
11
|
+
readonly_attr :mrr
|
12
|
+
readonly_attr :arr
|
13
|
+
readonly_attr :status
|
14
|
+
readonly_attr :billing_cycle
|
15
|
+
readonly_attr :billing_cycle_count
|
16
|
+
readonly_attr :start_date, type: :time
|
17
|
+
readonly_attr :end_date, type: :time
|
18
|
+
readonly_attr :currency
|
19
|
+
readonly_attr :currency_sign
|
20
|
+
|
21
|
+
def self.all(customer_uuid, options = {})
|
22
|
+
ChartMogul::Metrics::Customers::Subscriptions.all(customer_uuid, options)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class Subscriptions < APIResource
|
27
|
+
set_resource_name 'Subscriptions'
|
28
|
+
set_resource_path '/v1/customers/:customer_uuid/subscriptions'
|
29
|
+
|
30
|
+
include Concerns::Entries
|
31
|
+
include Concerns::Pageable
|
32
|
+
|
33
|
+
set_entry_class Subscription
|
34
|
+
|
35
|
+
def self.all(customer_uuid, options = {})
|
36
|
+
super(options.merge(customer_uuid: customer_uuid))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
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:
|
4
|
+
version: 2.0.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: 2021-
|
11
|
+
date: 2021-06-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -171,9 +171,10 @@ executables: []
|
|
171
171
|
extensions: []
|
172
172
|
extra_rdoc_files: []
|
173
173
|
files:
|
174
|
+
- ".github/workflows/test.yml"
|
174
175
|
- ".gitignore"
|
175
176
|
- ".rspec"
|
176
|
-
-
|
177
|
+
- 2.0-Upgrade.md
|
177
178
|
- Gemfile
|
178
179
|
- LICENSE.txt
|
179
180
|
- README.md
|
@@ -221,21 +222,24 @@ files:
|
|
221
222
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_ARR/behaves_like_Metrics_API_resource/should_have_entries.yml
|
222
223
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml
|
223
224
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_ASP/behaves_like_Metrics_API_resource/should_have_entries.yml
|
224
|
-
- fixtures/vcr_cassettes/ChartMogul_Metrics_Activity
|
225
|
+
- fixtures/vcr_cassettes/ChartMogul_Metrics_Activity.yml
|
226
|
+
- fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/behaves_like_PageableWithAnchor/should_be_pageable.yml
|
225
227
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_Activity/should_have_Activity_entries.yml
|
226
228
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_AllKeyMetric/should_have_entries.yml
|
227
229
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml
|
228
230
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml
|
229
231
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml
|
230
232
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_CustomerCount/behaves_like_Metrics_API_resource/should_have_entries.yml
|
233
|
+
- fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Activity/behaves_like_Pageable/should_be_pageable.yml
|
234
|
+
- fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Activity/should_have_Activity_entries.yml
|
235
|
+
- fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Subscription/behaves_like_Pageable/should_be_pageable.yml
|
236
|
+
- fixtures/vcr_cassettes/ChartMogul_Metrics_Customers_Subscription/should_have_Subscription_entries.yml
|
231
237
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml
|
232
238
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_LTV/behaves_like_Metrics_API_resource/should_have_entries.yml
|
233
239
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/behaves_like_Summary/should_have_summary.yml
|
234
240
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_MRR/should_have_entries.yml
|
235
241
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/behaves_like_Summary/should_have_summary.yml
|
236
242
|
- fixtures/vcr_cassettes/ChartMogul_Metrics_MRRChurnRate/behaves_like_Metrics_API_resource/should_have_entries.yml
|
237
|
-
- fixtures/vcr_cassettes/ChartMogul_Metrics_Subscription/behaves_like_Pageable/should_be_pageable.yml
|
238
|
-
- fixtures/vcr_cassettes/ChartMogul_Metrics_Subscription/should_have_Subscription_entries.yml
|
239
243
|
- fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_on_incorrect_credentials.yml
|
240
244
|
- fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_with_500_internal_server_error.yml
|
241
245
|
- fixtures/vcr_cassettes/ChartMogul_Ping/pings/and_fails_with_504_gateway_timeout_error.yml
|
@@ -274,6 +278,7 @@ files:
|
|
274
278
|
- lib/chartmogul/concerns/entries.rb
|
275
279
|
- lib/chartmogul/concerns/pageable.rb
|
276
280
|
- lib/chartmogul/concerns/pageable2.rb
|
281
|
+
- lib/chartmogul/concerns/pageable_with_anchor.rb
|
277
282
|
- lib/chartmogul/concerns/summary.rb
|
278
283
|
- lib/chartmogul/config_attributes.rb
|
279
284
|
- lib/chartmogul/configuration.rb
|
@@ -300,10 +305,11 @@ files:
|
|
300
305
|
- lib/chartmogul/metrics/base.rb
|
301
306
|
- lib/chartmogul/metrics/customer_churn_rate.rb
|
302
307
|
- lib/chartmogul/metrics/customer_count.rb
|
308
|
+
- lib/chartmogul/metrics/customers/activity.rb
|
309
|
+
- lib/chartmogul/metrics/customers/subscription.rb
|
303
310
|
- lib/chartmogul/metrics/ltv.rb
|
304
311
|
- lib/chartmogul/metrics/mrr.rb
|
305
312
|
- lib/chartmogul/metrics/mrr_churn_rate.rb
|
306
|
-
- lib/chartmogul/metrics/subscription.rb
|
307
313
|
- lib/chartmogul/object.rb
|
308
314
|
- lib/chartmogul/ping.rb
|
309
315
|
- lib/chartmogul/plan.rb
|
data/.travis.yml
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
os: linux
|
2
|
-
dist: bionic
|
3
|
-
|
4
|
-
language: ruby
|
5
|
-
|
6
|
-
rvm:
|
7
|
-
- 2.3
|
8
|
-
- 2.4
|
9
|
-
- 2.5
|
10
|
-
- 2.6
|
11
|
-
- 2.7
|
12
|
-
|
13
|
-
before_install: gem install bundler
|
14
|
-
|
15
|
-
before_script:
|
16
|
-
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
17
|
-
- chmod +x ./cc-test-reporter
|
18
|
-
- ./cc-test-reporter before-build
|
19
|
-
|
20
|
-
branches:
|
21
|
-
only:
|
22
|
-
- main
|
23
|
-
|
24
|
-
after_script:
|
25
|
-
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
@@ -1,39 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module ChartMogul
|
4
|
-
module Metrics
|
5
|
-
class Subscription < ChartMogul::Object
|
6
|
-
readonly_attr :id
|
7
|
-
readonly_attr :external_id
|
8
|
-
readonly_attr :plan
|
9
|
-
readonly_attr :quantity
|
10
|
-
readonly_attr :mrr
|
11
|
-
readonly_attr :arr
|
12
|
-
readonly_attr :status
|
13
|
-
readonly_attr :billing_cycle
|
14
|
-
readonly_attr :billing_cycle_count
|
15
|
-
readonly_attr :start_date, type: :time
|
16
|
-
readonly_attr :end_date, type: :time
|
17
|
-
readonly_attr :currency
|
18
|
-
readonly_attr :currency_sign
|
19
|
-
|
20
|
-
def self.all(customer_uuid, options = {})
|
21
|
-
ChartMogul::Metrics::Subscriptions.all(customer_uuid, options)
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
class Subscriptions < APIResource
|
26
|
-
set_resource_name 'Subscriptions'
|
27
|
-
set_resource_path '/v1/customers/:customer_uuid/subscriptions'
|
28
|
-
|
29
|
-
include Concerns::Entries
|
30
|
-
include Concerns::Pageable
|
31
|
-
|
32
|
-
set_entry_class Subscription
|
33
|
-
|
34
|
-
def self.all(customer_uuid, options = {})
|
35
|
-
super(options.merge(customer_uuid: customer_uuid))
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|