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
@@ -1,4 +1,4 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class ConfigurationError < ChartMogulError
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
class ConfigurationError < ChartMogulError
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class ForbiddenError < ChartMogulError
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
class ForbiddenError < ChartMogulError
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class NotFoundError < ChartMogulError
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
class NotFoundError < ChartMogulError
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class ResourceInvalidError < ChartMogulError
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
class ResourceInvalidError < ChartMogulError
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class SchemaInvalidError < ChartMogulError
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
class SchemaInvalidError < ChartMogulError
|
3
|
+
end
|
4
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class UnauthorizedError < ChartMogulError
|
3
|
-
end
|
4
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
class UnauthorizedError < ChartMogulError
|
3
|
+
end
|
4
|
+
end
|
data/lib/chartmogul/invoice.rb
CHANGED
@@ -1,78 +1,83 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
class Invoice <
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
writeable_attr :
|
10
|
-
writeable_attr :
|
11
|
-
writeable_attr :
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
1
|
+
module ChartMogul
|
2
|
+
class Invoice < APIResource
|
3
|
+
set_resource_name 'Invoice'
|
4
|
+
set_resource_path '/v1/invoices'
|
5
|
+
|
6
|
+
readonly_attr :uuid
|
7
|
+
readonly_attr :customer_uuid
|
8
|
+
|
9
|
+
writeable_attr :date, type: :time
|
10
|
+
writeable_attr :currency
|
11
|
+
writeable_attr :line_items, default: []
|
12
|
+
writeable_attr :transactions, default: []
|
13
|
+
writeable_attr :external_id
|
14
|
+
writeable_attr :due_date, type: :time
|
15
|
+
|
16
|
+
include API::Actions::Destroy
|
17
|
+
|
18
|
+
def serialize_line_items
|
19
|
+
line_items.map(&:serialize_for_write)
|
20
|
+
end
|
21
|
+
|
22
|
+
def serialize_transactions
|
23
|
+
transactions.map(&:serialize_for_write)
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def set_line_items(line_items_attributes)
|
29
|
+
@line_items = line_items_attributes.map.with_index do |line_item_attributes, index|
|
30
|
+
existing_line_item = line_items[index]
|
31
|
+
|
32
|
+
if existing_line_item
|
33
|
+
existing_line_item.assign_all_attributes(line_item_attributes)
|
34
|
+
else
|
35
|
+
line_item_class(line_item_attributes[:type])
|
36
|
+
.new_from_json(line_item_attributes.merge(invoice_uuid: uuid))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def set_transactions(transactions_attributes)
|
42
|
+
@transactions = transactions_attributes.map.with_index do |transaction_attributes, index|
|
43
|
+
existing_transaction = transactions[index]
|
44
|
+
|
45
|
+
if existing_transaction
|
46
|
+
existing_transaction.assign_all_attributes(transaction_attributes)
|
47
|
+
else
|
48
|
+
transaction_class(transaction_attributes[:type])
|
49
|
+
.new_from_json(transaction_attributes.merge(invoice_uuid: uuid))
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def line_item_class(type)
|
55
|
+
case type
|
56
|
+
when 'subscription' then ChartMogul::LineItems::Subscription
|
57
|
+
when 'one_time' then ChartMogul::LineItems::OneTime
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def transaction_class(type)
|
62
|
+
case type
|
63
|
+
when 'payment' then ChartMogul::Transactions::Payment
|
64
|
+
when 'refund' then ChartMogul::Transactions::Refund
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def self.all(options = {})
|
69
|
+
Invoices.all(options)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
class Invoices < APIResource
|
73
|
+
set_resource_name 'Invoices'
|
74
|
+
set_resource_path '/v1/invoices'
|
75
|
+
|
76
|
+
set_resource_root_key :invoices
|
77
|
+
|
78
|
+
include Concerns::Entries
|
79
|
+
include Concerns::Pageable2
|
80
|
+
|
81
|
+
set_entry_class Invoice
|
82
|
+
end
|
83
|
+
end
|
@@ -1,23 +1,23 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
module LineItems
|
3
|
-
class OneTime < ChartMogul::Object
|
4
|
-
readonly_attr :uuid
|
5
|
-
|
6
|
-
writeable_attr :type, default: 'one_time'
|
7
|
-
writeable_attr :amount_in_cents
|
8
|
-
writeable_attr :description
|
9
|
-
writeable_attr :quantity
|
10
|
-
writeable_attr :discount_amount_in_cents
|
11
|
-
writeable_attr :discount_code
|
12
|
-
writeable_attr :tax_amount_in_cents
|
13
|
-
writeable_attr :external_id
|
14
|
-
|
15
|
-
writeable_attr :invoice_uuid
|
16
|
-
|
17
|
-
def initialize(attributes = {})
|
18
|
-
super(attributes)
|
19
|
-
@type = 'one_time'
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
module LineItems
|
3
|
+
class OneTime < ChartMogul::Object
|
4
|
+
readonly_attr :uuid
|
5
|
+
|
6
|
+
writeable_attr :type, default: 'one_time'
|
7
|
+
writeable_attr :amount_in_cents
|
8
|
+
writeable_attr :description
|
9
|
+
writeable_attr :quantity
|
10
|
+
writeable_attr :discount_amount_in_cents
|
11
|
+
writeable_attr :discount_code
|
12
|
+
writeable_attr :tax_amount_in_cents
|
13
|
+
writeable_attr :external_id
|
14
|
+
|
15
|
+
writeable_attr :invoice_uuid
|
16
|
+
|
17
|
+
def initialize(attributes = {})
|
18
|
+
super(attributes)
|
19
|
+
@type = 'one_time'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -1,29 +1,29 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
module LineItems
|
3
|
-
class Subscription < ChartMogul::Object
|
4
|
-
readonly_attr :uuid
|
5
|
-
|
6
|
-
writeable_attr :type, default: 'subscription'
|
7
|
-
writeable_attr :subscription_external_id
|
8
|
-
writeable_attr :service_period_start, type: :time
|
9
|
-
writeable_attr :service_period_end, type: :time
|
10
|
-
writeable_attr :amount_in_cents
|
11
|
-
writeable_attr :cancelled_at, type: :time
|
12
|
-
writeable_attr :prorated
|
13
|
-
writeable_attr :quantity
|
14
|
-
writeable_attr :discount_amount_in_cents
|
15
|
-
writeable_attr :discount_code
|
16
|
-
writeable_attr :tax_amount_in_cents
|
17
|
-
writeable_attr :external_id
|
18
|
-
|
19
|
-
readonly_attr :subscription_uuid
|
20
|
-
writeable_attr :invoice_uuid
|
21
|
-
writeable_attr :plan_uuid
|
22
|
-
|
23
|
-
def initialize(attributes = {})
|
24
|
-
super(attributes)
|
25
|
-
@type = 'subscription'
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
1
|
+
module ChartMogul
|
2
|
+
module LineItems
|
3
|
+
class Subscription < ChartMogul::Object
|
4
|
+
readonly_attr :uuid
|
5
|
+
|
6
|
+
writeable_attr :type, default: 'subscription'
|
7
|
+
writeable_attr :subscription_external_id
|
8
|
+
writeable_attr :service_period_start, type: :time
|
9
|
+
writeable_attr :service_period_end, type: :time
|
10
|
+
writeable_attr :amount_in_cents
|
11
|
+
writeable_attr :cancelled_at, type: :time
|
12
|
+
writeable_attr :prorated
|
13
|
+
writeable_attr :quantity
|
14
|
+
writeable_attr :discount_amount_in_cents
|
15
|
+
writeable_attr :discount_code
|
16
|
+
writeable_attr :tax_amount_in_cents
|
17
|
+
writeable_attr :external_id
|
18
|
+
|
19
|
+
readonly_attr :subscription_uuid
|
20
|
+
writeable_attr :invoice_uuid
|
21
|
+
writeable_attr :plan_uuid
|
22
|
+
|
23
|
+
def initialize(attributes = {})
|
24
|
+
super(attributes)
|
25
|
+
@type = 'subscription'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -1,34 +1,34 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
module Metrics
|
3
|
-
class Activity < ChartMogul::Object
|
4
|
-
readonly_attr :id
|
5
|
-
readonly_attr :description
|
6
|
-
readonly_attr :type
|
7
|
-
readonly_attr :date, type: :time
|
8
|
-
readonly_attr :activity_arr
|
9
|
-
readonly_attr :activity_mrr
|
10
|
-
readonly_attr :activity_mrr_movement
|
11
|
-
readonly_attr :currency
|
12
|
-
readonly_attr :currency_sign
|
13
|
-
|
14
|
-
def self.all(customer_uuid, options = {})
|
15
|
-
ChartMogul::Metrics::Activities.all(customer_uuid, options)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
class Activities < APIResource
|
20
|
-
set_resource_name 'Activities'
|
21
|
-
set_resource_path '/v1/customers/:customer_uuid/activities'
|
22
|
-
|
23
|
-
include Concerns::Entries
|
24
|
-
include Concerns::Pageable
|
25
|
-
|
26
|
-
set_entry_class Activity
|
27
|
-
|
28
|
-
def self.all(customer_uuid, options = {})
|
29
|
-
super(options.merge(customer_uuid: customer_uuid))
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
1
|
+
module ChartMogul
|
2
|
+
module Metrics
|
3
|
+
class Activity < ChartMogul::Object
|
4
|
+
readonly_attr :id
|
5
|
+
readonly_attr :description
|
6
|
+
readonly_attr :type
|
7
|
+
readonly_attr :date, type: :time
|
8
|
+
readonly_attr :activity_arr
|
9
|
+
readonly_attr :activity_mrr
|
10
|
+
readonly_attr :activity_mrr_movement
|
11
|
+
readonly_attr :currency
|
12
|
+
readonly_attr :currency_sign
|
13
|
+
|
14
|
+
def self.all(customer_uuid, options = {})
|
15
|
+
ChartMogul::Metrics::Activities.all(customer_uuid, options)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
class Activities < APIResource
|
20
|
+
set_resource_name 'Activities'
|
21
|
+
set_resource_path '/v1/customers/:customer_uuid/activities'
|
22
|
+
|
23
|
+
include Concerns::Entries
|
24
|
+
include Concerns::Pageable
|
25
|
+
|
26
|
+
set_entry_class Activity
|
27
|
+
|
28
|
+
def self.all(customer_uuid, options = {})
|
29
|
+
super(options.merge(customer_uuid: customer_uuid))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
@@ -1,25 +1,25 @@
|
|
1
|
-
module ChartMogul
|
2
|
-
module Metrics
|
3
|
-
class AllKeyMetric < ChartMogul::Object
|
4
|
-
readonly_attr :date, type: :date
|
5
|
-
readonly_attr :arpa
|
6
|
-
readonly_attr :arr
|
7
|
-
readonly_attr :asp
|
8
|
-
readonly_attr :customer_churn_rate
|
9
|
-
readonly_attr :customers
|
10
|
-
readonly_attr :ltv
|
11
|
-
readonly_attr :mrr
|
12
|
-
readonly_attr :mrr_churn_rate
|
13
|
-
end
|
14
|
-
|
15
|
-
class AllKeyMetrics < APIResource
|
16
|
-
set_resource_name 'All Key Metrics'
|
17
|
-
set_resource_path '/v1/metrics/all'
|
18
|
-
|
19
|
-
include Concerns::Entries
|
20
|
-
|
21
|
-
set_entry_class AllKeyMetric
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
1
|
+
module ChartMogul
|
2
|
+
module Metrics
|
3
|
+
class AllKeyMetric < ChartMogul::Object
|
4
|
+
readonly_attr :date, type: :date
|
5
|
+
readonly_attr :arpa
|
6
|
+
readonly_attr :arr
|
7
|
+
readonly_attr :asp
|
8
|
+
readonly_attr :customer_churn_rate
|
9
|
+
readonly_attr :customers
|
10
|
+
readonly_attr :ltv
|
11
|
+
readonly_attr :mrr
|
12
|
+
readonly_attr :mrr_churn_rate
|
13
|
+
end
|
14
|
+
|
15
|
+
class AllKeyMetrics < APIResource
|
16
|
+
set_resource_name 'All Key Metrics'
|
17
|
+
set_resource_path '/v1/metrics/all'
|
18
|
+
|
19
|
+
include Concerns::Entries
|
20
|
+
|
21
|
+
set_entry_class AllKeyMetric
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|