togai_client 1.0.0 → 1.0.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.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/docs/AccountsApi.md +1 -1
- data/docs/AssociatePricePlanRequest.md +4 -4
- data/docs/Bundle.md +22 -0
- data/docs/CreatePricePlanRequest.md +2 -4
- data/docs/EventPipelineInfoPricePlansInner.md +2 -0
- data/docs/EventSchemaListData.md +2 -2
- data/docs/EventSchemaListDataAllOf.md +2 -2
- data/docs/GetEventResponse.md +1 -1
- data/docs/PlanOverride.md +2 -2
- data/docs/PricePlan.md +0 -2
- data/docs/PricePlanDetails.md +20 -0
- data/docs/PricePlanDetailsOverride.md +20 -0
- data/docs/PricePlanListData.md +2 -4
- data/docs/PricePlanPaginatedResponse.md +1 -1
- data/docs/PricePlansApi.md +1 -1
- data/docs/PriceType.md +15 -0
- data/docs/{PricingCycle.md → PricingCycleConfig.md} +3 -3
- data/docs/{PricingCycleStartOffset.md → PricingCycleConfigStartOffset.md} +2 -2
- data/docs/PricingModel.md +15 -0
- data/docs/PricingSchedule.md +2 -2
- data/docs/RateCard.md +6 -6
- data/docs/RateCardBundleAggregation.md +15 -0
- data/docs/RateCardType.md +15 -0
- data/docs/RateConfigBundle.md +20 -0
- data/docs/RateConfigUsage.md +20 -0
- data/docs/SlabBundle.md +24 -0
- data/docs/{UsageStrategy.md → SlabUsage.md} +6 -2
- data/docs/UpdatePricePlanRequest.md +2 -4
- data/examples/example.rb +222 -0
- data/lib/togai_client/models/associate_price_plan_request.rb +17 -7
- data/lib/togai_client/models/{bundle_strategy.rb → bundle.rb} +34 -85
- data/lib/togai_client/models/create_customer_request.rb +0 -9
- data/lib/togai_client/models/create_customer_response.rb +0 -9
- data/lib/togai_client/models/create_price_plan_request.rb +10 -24
- data/lib/togai_client/models/customer.rb +0 -9
- data/lib/togai_client/models/event_pipeline_info_price_plans_inner.rb +15 -1
- data/lib/togai_client/models/event_schema_list_data.rb +7 -9
- data/lib/togai_client/models/event_schema_list_data_all_of.rb +7 -9
- data/lib/togai_client/models/get_event_response.rb +5 -0
- data/lib/togai_client/models/ingestion_status.rb +2 -2
- data/lib/togai_client/models/plan_override.rb +7 -7
- data/lib/togai_client/models/price_plan.rb +1 -15
- data/lib/togai_client/models/price_plan_details.rb +259 -0
- data/lib/togai_client/models/price_plan_details_override.rb +245 -0
- data/lib/togai_client/models/price_plan_list_data.rb +10 -25
- data/lib/togai_client/models/price_plan_paginated_response.rb +5 -0
- data/lib/togai_client/models/price_type.rb +38 -0
- data/lib/togai_client/models/{pricing_cycle.rb → pricing_cycle_config.rb} +4 -4
- data/lib/togai_client/models/{pricing_cycle_start_offset.rb → pricing_cycle_config_start_offset.rb} +3 -3
- data/lib/togai_client/models/pricing_model.rb +37 -0
- data/lib/togai_client/models/pricing_schedule.rb +7 -7
- data/lib/togai_client/models/rate_card.rb +32 -59
- data/lib/togai_client/models/rate_card_bundle_aggregation.rb +39 -0
- data/lib/togai_client/models/rate_card_type.rb +37 -0
- data/lib/togai_client/models/{bundle_strategy_usage_meters_value.rb → rate_config_bundle.rb} +28 -13
- data/lib/togai_client/models/{rate_card_usage_value.rb → rate_config_usage.rb} +15 -98
- data/lib/togai_client/models/signup_request.rb +0 -11
- data/lib/togai_client/models/slab_bundle.rb +264 -0
- data/lib/togai_client/models/{usage_strategy.rb → slab_usage.rb} +30 -5
- data/lib/togai_client/models/update_customer_request.rb +0 -9
- data/lib/togai_client/models/update_price_plan_request.rb +7 -16
- data/lib/togai_client/models/user_details.rb +0 -11
- data/lib/togai_client/version.rb +1 -1
- data/lib/togai_client.rb +13 -7
- metadata +36 -23
- data/docs/BundleStrategy.md +0 -24
- data/docs/BundleStrategyUsageMetersValue.md +0 -18
- data/docs/RateCardBundle.md +0 -22
- data/docs/RateCardUsageValue.md +0 -24
- data/lib/togai_client/models/rate_card_bundle.rb +0 -328
data/examples/example.rb
ADDED
@@ -0,0 +1,222 @@
|
|
1
|
+
require 'togai_client'
|
2
|
+
|
3
|
+
API_TOKEN = "YOUR_API_TOKEN"
|
4
|
+
BASE_PATH = "sandbox-api.togai.com"
|
5
|
+
|
6
|
+
##### Convert the above python code to ruby
|
7
|
+
|
8
|
+
TogaiClient.configure do |config|
|
9
|
+
config.host = BASE_PATH
|
10
|
+
config.access_token = API_TOKEN
|
11
|
+
config.server_index = nil
|
12
|
+
end
|
13
|
+
|
14
|
+
# Following example simulates the pricing of an API based SMS service which charges their customers based on region and size of the message.
|
15
|
+
# Follow the steps below to create the required entities in Togai, and then ingest an event.
|
16
|
+
|
17
|
+
# Step 1: Create an Event Schema to define the event structure, attributes (can be usage value) and dimensions (can be used filters in usage meters i.e country in this case)
|
18
|
+
event_schema_api = TogaiClient::EventSchemasApi.new
|
19
|
+
create_event_schema_request = TogaiClient::CreateEventSchemaRequest.new(
|
20
|
+
name: "message_sent",
|
21
|
+
attributes: [
|
22
|
+
TogaiClient::EventAttributeSchema.new(
|
23
|
+
name: "sms_id"
|
24
|
+
)
|
25
|
+
],
|
26
|
+
dimensions: [
|
27
|
+
TogaiClient::DimensionsSchema.new(
|
28
|
+
name: "country"
|
29
|
+
)
|
30
|
+
]
|
31
|
+
)
|
32
|
+
|
33
|
+
event_schema = event_schema_api.create_event_schema(create_event_schema_request)
|
34
|
+
pp event_schema
|
35
|
+
|
36
|
+
|
37
|
+
# Step 2: Activate the Event Schema
|
38
|
+
event_schema_api.activate_event_schema(event_schema.name)
|
39
|
+
|
40
|
+
# Step 3: Create a Usage Meter to meter the usage with aggregation methods
|
41
|
+
usage_meters_api = TogaiClient::UsageMetersApi.new
|
42
|
+
create_usage_meter_request = TogaiClient::CreateUsageMeterRequest.new(
|
43
|
+
name: "message_count",
|
44
|
+
type: "COUNTER",
|
45
|
+
aggregation: "COUNT",
|
46
|
+
computations: [
|
47
|
+
TogaiClient::Computation.new(
|
48
|
+
matcher: '''{
|
49
|
+
"==": [
|
50
|
+
{
|
51
|
+
"var": "dimensions.country"
|
52
|
+
},
|
53
|
+
"US"
|
54
|
+
]
|
55
|
+
}''',
|
56
|
+
computation: "1"
|
57
|
+
)
|
58
|
+
]
|
59
|
+
)
|
60
|
+
usage_meter = usage_meters_api.create_usage_meter(event_schema.name, create_usage_meter_request)
|
61
|
+
pp usage_meter
|
62
|
+
|
63
|
+
# Step 4: Activate a usage meter
|
64
|
+
usage_meters_api.activate_usage_meter(event_schema.name, usage_meter.name)
|
65
|
+
|
66
|
+
# Step 5: Create a Price plan to convert the usage into a billable price
|
67
|
+
create_price_plan_request = TogaiClient::CreatePricePlanRequest.new(
|
68
|
+
name: "price-plan",
|
69
|
+
price_plan_details: TogaiClient::PricePlanDetails.new(
|
70
|
+
pricing_cycle_config: TogaiClient::PricingCycleConfig.new(
|
71
|
+
interval: "MONTHLY",
|
72
|
+
start_type: "STATIC",
|
73
|
+
start_offset: TogaiClient::PricingCycleConfigStartOffset.new(
|
74
|
+
day_offset: "1",
|
75
|
+
month_offset: "NIL"
|
76
|
+
),
|
77
|
+
grace_period: 1
|
78
|
+
),
|
79
|
+
rate_cards: [
|
80
|
+
TogaiClient::RateCard.new(
|
81
|
+
display_name: "SMS charges",
|
82
|
+
pricing_model: TogaiClient::PricingModel::TIERED,
|
83
|
+
rate_config: TogaiClient::RateConfigUsage.new(
|
84
|
+
usage_meter_name: usage_meter.name,
|
85
|
+
slabs: [
|
86
|
+
TogaiClient::SlabUsage.new(
|
87
|
+
rate: 0.2,
|
88
|
+
start_after: 0.0,
|
89
|
+
price_type: TogaiClient::PriceType::PER_UNIT,
|
90
|
+
order: 1
|
91
|
+
),
|
92
|
+
TogaiClient::SlabUsage.new(
|
93
|
+
rate: 0.1,
|
94
|
+
start_after: 10000.0,
|
95
|
+
price_type: TogaiClient::PriceType::PER_UNIT,
|
96
|
+
order: 2
|
97
|
+
)
|
98
|
+
]
|
99
|
+
)
|
100
|
+
)
|
101
|
+
]
|
102
|
+
)
|
103
|
+
)
|
104
|
+
price_plan_api = TogaiClient::PricePlansApi.new
|
105
|
+
price_plan = price_plan_api.create_price_plan(create_price_plan_request)
|
106
|
+
pp price_plan
|
107
|
+
|
108
|
+
|
109
|
+
# Step 6: Activate the Price Plan
|
110
|
+
price_plan_api.activate_price_plan(price_plan.name)
|
111
|
+
|
112
|
+
# Step 7: Create customers to associate price plans
|
113
|
+
create_customer_request = TogaiClient::CreateCustomerRequest.new(
|
114
|
+
name: "customer1",
|
115
|
+
id: "1",
|
116
|
+
primary_email: "email@togai.com",
|
117
|
+
billing_address: "221B Baker Street, Marylebone, London NW1 6XE, United Kingdom"
|
118
|
+
)
|
119
|
+
customers_api = TogaiClient::CustomersApi.new
|
120
|
+
customer = customers_api.create_customer(create_customer_request)
|
121
|
+
pp customer
|
122
|
+
|
123
|
+
# Step 8: Associate the customer/account to the price plan
|
124
|
+
associate_price_plan_request = TogaiClient::AssociatePricePlanRequest.new(
|
125
|
+
price_plan_name: price_plan.name,
|
126
|
+
effective_from: Date.today,
|
127
|
+
effective_until: Date.new(9999, 1, 1)
|
128
|
+
)
|
129
|
+
associate_price_plan_api = TogaiClient::AccountsApi.new
|
130
|
+
associate_price_plan = associate_price_plan_api.associate_price_plan(customer.id, customer.id, associate_price_plan_request)
|
131
|
+
pp associate_price_plan
|
132
|
+
|
133
|
+
# Step 9: Ingest events
|
134
|
+
events_api = TogaiClient::EventIngestionApi.new
|
135
|
+
event_request = TogaiClient::IngestEventRequest.new(
|
136
|
+
event: TogaiClient::Event.new(
|
137
|
+
id: "random-string" + rand.to_s,
|
138
|
+
event_name: event_schema.name,
|
139
|
+
event_timestamp: DateTime.now,
|
140
|
+
account_id: customer.id,
|
141
|
+
event_attributes: [
|
142
|
+
TogaiClient::EventAttribute.new(
|
143
|
+
attribute_name: "sms_id",
|
144
|
+
attribute_value: "random-string" + rand.to_s
|
145
|
+
)
|
146
|
+
],
|
147
|
+
dimensions: {
|
148
|
+
"country": "US"
|
149
|
+
}
|
150
|
+
)
|
151
|
+
)
|
152
|
+
event = events_api.ingest(event_request)
|
153
|
+
pp event
|
154
|
+
|
155
|
+
sleep(61)
|
156
|
+
|
157
|
+
# Step 10: Get the usage metrics
|
158
|
+
now = DateTime.now
|
159
|
+
yesterday = DateTime.now - 1
|
160
|
+
metrics_api = TogaiClient::MetricsApi.new
|
161
|
+
usage_metrics_request = TogaiClient::GetMetricsRequest.new(
|
162
|
+
start_time: yesterday,
|
163
|
+
end_time: now,
|
164
|
+
metric_queries: [
|
165
|
+
TogaiClient::MetricQuery.new(
|
166
|
+
id: "usage-metrics",
|
167
|
+
name: TogaiClient::MetricName::USAGE,
|
168
|
+
aggregation_period: "DAY"
|
169
|
+
)
|
170
|
+
]
|
171
|
+
)
|
172
|
+
usage_metrics = metrics_api.get_metrics(get_metrics_request: usage_metrics_request)
|
173
|
+
pp usage_metrics
|
174
|
+
|
175
|
+
# Step 11: Get the revenue metrics
|
176
|
+
# Revenue metrics might take a bit of time to be reflected in the system
|
177
|
+
# You can check the docs on the amount of time it takes for events to get processed for revenue.
|
178
|
+
revenue_metrics_request = TogaiClient::GetMetricsRequest.new(
|
179
|
+
start_time: yesterday,
|
180
|
+
end_time: now,
|
181
|
+
metric_queries: [
|
182
|
+
TogaiClient::MetricQuery.new(
|
183
|
+
id: "revenue-metrics",
|
184
|
+
name: TogaiClient::MetricName::REVENUE,
|
185
|
+
aggregation_period: "DAY"
|
186
|
+
)
|
187
|
+
]
|
188
|
+
)
|
189
|
+
revenue_metrics = metrics_api.get_metrics(get_metrics_request: revenue_metrics_request)
|
190
|
+
pp revenue_metrics
|
191
|
+
|
192
|
+
# Revenue metrics for a specific customer
|
193
|
+
customer_revenue_metrics_request = TogaiClient::GetMetricsRequest.new(
|
194
|
+
start_time: yesterday,
|
195
|
+
end_time: now,
|
196
|
+
metric_queries: [
|
197
|
+
TogaiClient::MetricQuery.new(
|
198
|
+
id: "customer-revenue-metrics",
|
199
|
+
name: TogaiClient::MetricName::REVENUE,
|
200
|
+
aggregation_period: "DAY",
|
201
|
+
filters: [
|
202
|
+
TogaiClient::MetricQueryFilterEntry.new(
|
203
|
+
field_name: "CUSTOMER_ID",
|
204
|
+
field_values: [customer.id]
|
205
|
+
)
|
206
|
+
]
|
207
|
+
)
|
208
|
+
]
|
209
|
+
)
|
210
|
+
customer_revenue_metrics = metrics_api.get_metrics(get_metrics_request: customer_revenue_metrics_request)
|
211
|
+
pp customer_revenue_metrics
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
|
222
|
+
|
@@ -25,7 +25,7 @@ module TogaiClient
|
|
25
25
|
# Date until which the association must be effective. - Expected only if effectiveFrom is present.
|
26
26
|
attr_accessor :effective_until
|
27
27
|
|
28
|
-
attr_accessor :
|
28
|
+
attr_accessor :price_plan_details_override
|
29
29
|
|
30
30
|
# Attribute mapping from ruby-style variable name to JSON key.
|
31
31
|
def self.attribute_map
|
@@ -33,7 +33,7 @@ module TogaiClient
|
|
33
33
|
:'price_plan_name' => :'pricePlanName',
|
34
34
|
:'effective_from' => :'effectiveFrom',
|
35
35
|
:'effective_until' => :'effectiveUntil',
|
36
|
-
:'
|
36
|
+
:'price_plan_details_override' => :'pricePlanDetailsOverride'
|
37
37
|
}
|
38
38
|
end
|
39
39
|
|
@@ -48,7 +48,7 @@ module TogaiClient
|
|
48
48
|
:'price_plan_name' => :'String',
|
49
49
|
:'effective_from' => :'Date',
|
50
50
|
:'effective_until' => :'Date',
|
51
|
-
:'
|
51
|
+
:'price_plan_details_override' => :'PricePlanDetailsOverride'
|
52
52
|
}
|
53
53
|
end
|
54
54
|
|
@@ -85,8 +85,8 @@ module TogaiClient
|
|
85
85
|
self.effective_until = attributes[:'effective_until']
|
86
86
|
end
|
87
87
|
|
88
|
-
if attributes.key?(:'
|
89
|
-
self.
|
88
|
+
if attributes.key?(:'price_plan_details_override')
|
89
|
+
self.price_plan_details_override = attributes[:'price_plan_details_override']
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
@@ -102,6 +102,14 @@ module TogaiClient
|
|
102
102
|
invalid_properties.push('invalid value for "price_plan_name", the character length must be smaller than or equal to 50.')
|
103
103
|
end
|
104
104
|
|
105
|
+
if @effective_from.nil?
|
106
|
+
invalid_properties.push('invalid value for "effective_from", effective_from cannot be nil.')
|
107
|
+
end
|
108
|
+
|
109
|
+
if @effective_until.nil?
|
110
|
+
invalid_properties.push('invalid value for "effective_until", effective_until cannot be nil.')
|
111
|
+
end
|
112
|
+
|
105
113
|
invalid_properties
|
106
114
|
end
|
107
115
|
|
@@ -110,6 +118,8 @@ module TogaiClient
|
|
110
118
|
def valid?
|
111
119
|
return false if @price_plan_name.nil?
|
112
120
|
return false if @price_plan_name.to_s.length > 50
|
121
|
+
return false if @effective_from.nil?
|
122
|
+
return false if @effective_until.nil?
|
113
123
|
true
|
114
124
|
end
|
115
125
|
|
@@ -135,7 +145,7 @@ module TogaiClient
|
|
135
145
|
price_plan_name == o.price_plan_name &&
|
136
146
|
effective_from == o.effective_from &&
|
137
147
|
effective_until == o.effective_until &&
|
138
|
-
|
148
|
+
price_plan_details_override == o.price_plan_details_override
|
139
149
|
end
|
140
150
|
|
141
151
|
# @see the `==` method
|
@@ -147,7 +157,7 @@ module TogaiClient
|
|
147
157
|
# Calculates hash code according to all attributes.
|
148
158
|
# @return [Integer] Hash code
|
149
159
|
def hash
|
150
|
-
[price_plan_name, effective_from, effective_until,
|
160
|
+
[price_plan_name, effective_from, effective_until, price_plan_details_override].hash
|
151
161
|
end
|
152
162
|
|
153
163
|
# Builds the object from hash
|
@@ -14,23 +14,20 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module TogaiClient
|
17
|
-
#
|
18
|
-
class
|
19
|
-
attr_accessor :
|
20
|
-
|
21
|
-
attr_accessor :rate
|
17
|
+
# TODO
|
18
|
+
class Bundle
|
19
|
+
attr_accessor :display_name
|
22
20
|
|
23
21
|
attr_accessor :order
|
24
22
|
|
25
|
-
attr_accessor :
|
23
|
+
attr_accessor :rate_configs
|
26
24
|
|
27
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
28
26
|
def self.attribute_map
|
29
27
|
{
|
30
|
-
:'
|
31
|
-
:'rate' => :'rate',
|
28
|
+
:'display_name' => :'displayName',
|
32
29
|
:'order' => :'order',
|
33
|
-
:'
|
30
|
+
:'rate_configs' => :'rateConfigs'
|
34
31
|
}
|
35
32
|
end
|
36
33
|
|
@@ -42,10 +39,9 @@ module TogaiClient
|
|
42
39
|
# Attribute type mapping.
|
43
40
|
def self.openapi_types
|
44
41
|
{
|
45
|
-
:'
|
46
|
-
:'rate' => :'Float',
|
42
|
+
:'display_name' => :'String',
|
47
43
|
:'order' => :'Integer',
|
48
|
-
:'
|
44
|
+
:'rate_configs' => :'Array<RateConfigBundle>'
|
49
45
|
}
|
50
46
|
end
|
51
47
|
|
@@ -59,32 +55,28 @@ module TogaiClient
|
|
59
55
|
# @param [Hash] attributes Model attributes in the form of hash
|
60
56
|
def initialize(attributes = {})
|
61
57
|
if (!attributes.is_a?(Hash))
|
62
|
-
fail ArgumentError, "The input argument (attributes) must be a hash in `TogaiClient::
|
58
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `TogaiClient::Bundle` initialize method"
|
63
59
|
end
|
64
60
|
|
65
61
|
# check to see if the attribute exists and convert string to symbol for hash key
|
66
62
|
attributes = attributes.each_with_object({}) { |(k, v), h|
|
67
63
|
if (!self.class.attribute_map.key?(k.to_sym))
|
68
|
-
fail ArgumentError, "`#{k}` is not a valid attribute in `TogaiClient::
|
64
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `TogaiClient::Bundle`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
69
65
|
end
|
70
66
|
h[k.to_sym] = v
|
71
67
|
}
|
72
68
|
|
73
|
-
if attributes.key?(:'
|
74
|
-
self.
|
75
|
-
end
|
76
|
-
|
77
|
-
if attributes.key?(:'rate')
|
78
|
-
self.rate = attributes[:'rate']
|
69
|
+
if attributes.key?(:'display_name')
|
70
|
+
self.display_name = attributes[:'display_name']
|
79
71
|
end
|
80
72
|
|
81
73
|
if attributes.key?(:'order')
|
82
74
|
self.order = attributes[:'order']
|
83
75
|
end
|
84
76
|
|
85
|
-
if attributes.key?(:'
|
86
|
-
if (value = attributes[:'
|
87
|
-
self.
|
77
|
+
if attributes.key?(:'rate_configs')
|
78
|
+
if (value = attributes[:'rate_configs']).is_a?(Array)
|
79
|
+
self.rate_configs = value
|
88
80
|
end
|
89
81
|
end
|
90
82
|
end
|
@@ -93,36 +85,20 @@ module TogaiClient
|
|
93
85
|
# @return Array for valid properties with the reasons
|
94
86
|
def list_invalid_properties
|
95
87
|
invalid_properties = Array.new
|
96
|
-
if @
|
97
|
-
invalid_properties.push('invalid value for "
|
98
|
-
end
|
99
|
-
|
100
|
-
if @name.to_s.length > 50
|
101
|
-
invalid_properties.push('invalid value for "name", the character length must be smaller than or equal to 50.')
|
102
|
-
end
|
103
|
-
|
104
|
-
if @name.to_s.length < 3
|
105
|
-
invalid_properties.push('invalid value for "name", the character length must be great than or equal to 3.')
|
106
|
-
end
|
107
|
-
|
108
|
-
if @rate.nil?
|
109
|
-
invalid_properties.push('invalid value for "rate", rate cannot be nil.')
|
88
|
+
if @display_name.nil?
|
89
|
+
invalid_properties.push('invalid value for "display_name", display_name cannot be nil.')
|
110
90
|
end
|
111
91
|
|
112
92
|
if @order.nil?
|
113
93
|
invalid_properties.push('invalid value for "order", order cannot be nil.')
|
114
94
|
end
|
115
95
|
|
116
|
-
if @
|
117
|
-
invalid_properties.push('invalid value for "
|
118
|
-
end
|
119
|
-
|
120
|
-
if @order < 1
|
121
|
-
invalid_properties.push('invalid value for "order", must be greater than or equal to 1.')
|
96
|
+
if @rate_configs.nil?
|
97
|
+
invalid_properties.push('invalid value for "rate_configs", rate_configs cannot be nil.')
|
122
98
|
end
|
123
99
|
|
124
|
-
if @
|
125
|
-
invalid_properties.push('invalid value for "
|
100
|
+
if @rate_configs.length < 1
|
101
|
+
invalid_properties.push('invalid value for "rate_configs", number of items must be greater than or equal to 1.')
|
126
102
|
end
|
127
103
|
|
128
104
|
invalid_properties
|
@@ -131,51 +107,25 @@ module TogaiClient
|
|
131
107
|
# Check to see if the all the properties in the model are valid
|
132
108
|
# @return true if the model is valid
|
133
109
|
def valid?
|
134
|
-
return false if @
|
135
|
-
return false if @name.to_s.length > 50
|
136
|
-
return false if @name.to_s.length < 3
|
137
|
-
return false if @rate.nil?
|
110
|
+
return false if @display_name.nil?
|
138
111
|
return false if @order.nil?
|
139
|
-
return false if @
|
140
|
-
return false if @
|
141
|
-
return false if @usage_meters.nil?
|
112
|
+
return false if @rate_configs.nil?
|
113
|
+
return false if @rate_configs.length < 1
|
142
114
|
true
|
143
115
|
end
|
144
116
|
|
145
117
|
# Custom attribute writer method with validation
|
146
|
-
# @param [Object]
|
147
|
-
def
|
148
|
-
if
|
149
|
-
fail ArgumentError, '
|
150
|
-
end
|
151
|
-
|
152
|
-
if name.to_s.length > 50
|
153
|
-
fail ArgumentError, 'invalid value for "name", the character length must be smaller than or equal to 50.'
|
154
|
-
end
|
155
|
-
|
156
|
-
if name.to_s.length < 3
|
157
|
-
fail ArgumentError, 'invalid value for "name", the character length must be great than or equal to 3.'
|
158
|
-
end
|
159
|
-
|
160
|
-
@name = name
|
161
|
-
end
|
162
|
-
|
163
|
-
# Custom attribute writer method with validation
|
164
|
-
# @param [Object] order Value to be assigned
|
165
|
-
def order=(order)
|
166
|
-
if order.nil?
|
167
|
-
fail ArgumentError, 'order cannot be nil'
|
168
|
-
end
|
169
|
-
|
170
|
-
if order > 10
|
171
|
-
fail ArgumentError, 'invalid value for "order", must be smaller than or equal to 10.'
|
118
|
+
# @param [Object] rate_configs Value to be assigned
|
119
|
+
def rate_configs=(rate_configs)
|
120
|
+
if rate_configs.nil?
|
121
|
+
fail ArgumentError, 'rate_configs cannot be nil'
|
172
122
|
end
|
173
123
|
|
174
|
-
if
|
175
|
-
fail ArgumentError, 'invalid value for "
|
124
|
+
if rate_configs.length < 1
|
125
|
+
fail ArgumentError, 'invalid value for "rate_configs", number of items must be greater than or equal to 1.'
|
176
126
|
end
|
177
127
|
|
178
|
-
@
|
128
|
+
@rate_configs = rate_configs
|
179
129
|
end
|
180
130
|
|
181
131
|
# Checks equality by comparing each attribute.
|
@@ -183,10 +133,9 @@ module TogaiClient
|
|
183
133
|
def ==(o)
|
184
134
|
return true if self.equal?(o)
|
185
135
|
self.class == o.class &&
|
186
|
-
|
187
|
-
rate == o.rate &&
|
136
|
+
display_name == o.display_name &&
|
188
137
|
order == o.order &&
|
189
|
-
|
138
|
+
rate_configs == o.rate_configs
|
190
139
|
end
|
191
140
|
|
192
141
|
# @see the `==` method
|
@@ -198,7 +147,7 @@ module TogaiClient
|
|
198
147
|
# Calculates hash code according to all attributes.
|
199
148
|
# @return [Integer] Hash code
|
200
149
|
def hash
|
201
|
-
[
|
150
|
+
[display_name, order, rate_configs].hash
|
202
151
|
end
|
203
152
|
|
204
153
|
# Builds the object from hash
|
@@ -139,10 +139,6 @@ module TogaiClient
|
|
139
139
|
invalid_properties.push('invalid value for "billing_address", the character length must be smaller than or equal to 1000.')
|
140
140
|
end
|
141
141
|
|
142
|
-
if @billing_address.to_s.length < 50
|
143
|
-
invalid_properties.push('invalid value for "billing_address", the character length must be great than or equal to 50.')
|
144
|
-
end
|
145
|
-
|
146
142
|
invalid_properties
|
147
143
|
end
|
148
144
|
|
@@ -158,7 +154,6 @@ module TogaiClient
|
|
158
154
|
return false if @primary_email.to_s.length > 255
|
159
155
|
return false if @billing_address.nil?
|
160
156
|
return false if @billing_address.to_s.length > 1000
|
161
|
-
return false if @billing_address.to_s.length < 50
|
162
157
|
true
|
163
158
|
end
|
164
159
|
|
@@ -219,10 +214,6 @@ module TogaiClient
|
|
219
214
|
fail ArgumentError, 'invalid value for "billing_address", the character length must be smaller than or equal to 1000.'
|
220
215
|
end
|
221
216
|
|
222
|
-
if billing_address.to_s.length < 50
|
223
|
-
fail ArgumentError, 'invalid value for "billing_address", the character length must be great than or equal to 50.'
|
224
|
-
end
|
225
|
-
|
226
217
|
@billing_address = billing_address
|
227
218
|
end
|
228
219
|
|
@@ -138,10 +138,6 @@ module TogaiClient
|
|
138
138
|
invalid_properties.push('invalid value for "billing_address", the character length must be smaller than or equal to 1000.')
|
139
139
|
end
|
140
140
|
|
141
|
-
if @billing_address.to_s.length < 50
|
142
|
-
invalid_properties.push('invalid value for "billing_address", the character length must be great than or equal to 50.')
|
143
|
-
end
|
144
|
-
|
145
141
|
invalid_properties
|
146
142
|
end
|
147
143
|
|
@@ -157,7 +153,6 @@ module TogaiClient
|
|
157
153
|
return false if @primary_email.to_s.length > 255
|
158
154
|
return false if @billing_address.nil?
|
159
155
|
return false if @billing_address.to_s.length > 1000
|
160
|
-
return false if @billing_address.to_s.length < 50
|
161
156
|
true
|
162
157
|
end
|
163
158
|
|
@@ -218,10 +213,6 @@ module TogaiClient
|
|
218
213
|
fail ArgumentError, 'invalid value for "billing_address", the character length must be smaller than or equal to 1000.'
|
219
214
|
end
|
220
215
|
|
221
|
-
if billing_address.to_s.length < 50
|
222
|
-
fail ArgumentError, 'invalid value for "billing_address", the character length must be great than or equal to 50.'
|
223
|
-
end
|
224
|
-
|
225
216
|
@billing_address = billing_address
|
226
217
|
end
|
227
218
|
|
@@ -22,17 +22,14 @@ module TogaiClient
|
|
22
22
|
# Description of price plan
|
23
23
|
attr_accessor :description
|
24
24
|
|
25
|
-
attr_accessor :
|
26
|
-
|
27
|
-
attr_accessor :rate_card
|
25
|
+
attr_accessor :price_plan_details
|
28
26
|
|
29
27
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
28
|
def self.attribute_map
|
31
29
|
{
|
32
30
|
:'name' => :'name',
|
33
31
|
:'description' => :'description',
|
34
|
-
:'
|
35
|
-
:'rate_card' => :'rateCard'
|
32
|
+
:'price_plan_details' => :'pricePlanDetails'
|
36
33
|
}
|
37
34
|
end
|
38
35
|
|
@@ -46,8 +43,7 @@ module TogaiClient
|
|
46
43
|
{
|
47
44
|
:'name' => :'String',
|
48
45
|
:'description' => :'String',
|
49
|
-
:'
|
50
|
-
:'rate_card' => :'RateCard'
|
46
|
+
:'price_plan_details' => :'PricePlanDetails'
|
51
47
|
}
|
52
48
|
end
|
53
49
|
|
@@ -80,12 +76,8 @@ module TogaiClient
|
|
80
76
|
self.description = attributes[:'description']
|
81
77
|
end
|
82
78
|
|
83
|
-
if attributes.key?(:'
|
84
|
-
self.
|
85
|
-
end
|
86
|
-
|
87
|
-
if attributes.key?(:'rate_card')
|
88
|
-
self.rate_card = attributes[:'rate_card']
|
79
|
+
if attributes.key?(:'price_plan_details')
|
80
|
+
self.price_plan_details = attributes[:'price_plan_details']
|
89
81
|
end
|
90
82
|
end
|
91
83
|
|
@@ -105,12 +97,8 @@ module TogaiClient
|
|
105
97
|
invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 255.')
|
106
98
|
end
|
107
99
|
|
108
|
-
if @
|
109
|
-
invalid_properties.push('invalid value for "
|
110
|
-
end
|
111
|
-
|
112
|
-
if @rate_card.nil?
|
113
|
-
invalid_properties.push('invalid value for "rate_card", rate_card cannot be nil.')
|
100
|
+
if @price_plan_details.nil?
|
101
|
+
invalid_properties.push('invalid value for "price_plan_details", price_plan_details cannot be nil.')
|
114
102
|
end
|
115
103
|
|
116
104
|
invalid_properties
|
@@ -122,8 +110,7 @@ module TogaiClient
|
|
122
110
|
return false if @name.nil?
|
123
111
|
return false if @name.to_s.length > 50
|
124
112
|
return false if !@description.nil? && @description.to_s.length > 255
|
125
|
-
return false if @
|
126
|
-
return false if @rate_card.nil?
|
113
|
+
return false if @price_plan_details.nil?
|
127
114
|
true
|
128
115
|
end
|
129
116
|
|
@@ -158,8 +145,7 @@ module TogaiClient
|
|
158
145
|
self.class == o.class &&
|
159
146
|
name == o.name &&
|
160
147
|
description == o.description &&
|
161
|
-
|
162
|
-
rate_card == o.rate_card
|
148
|
+
price_plan_details == o.price_plan_details
|
163
149
|
end
|
164
150
|
|
165
151
|
# @see the `==` method
|
@@ -171,7 +157,7 @@ module TogaiClient
|
|
171
157
|
# Calculates hash code according to all attributes.
|
172
158
|
# @return [Integer] Hash code
|
173
159
|
def hash
|
174
|
-
[name, description,
|
160
|
+
[name, description, price_plan_details].hash
|
175
161
|
end
|
176
162
|
|
177
163
|
# Builds the object from hash
|
@@ -178,10 +178,6 @@ module TogaiClient
|
|
178
178
|
invalid_properties.push('invalid value for "billing_address", the character length must be smaller than or equal to 1000.')
|
179
179
|
end
|
180
180
|
|
181
|
-
if @billing_address.to_s.length < 50
|
182
|
-
invalid_properties.push('invalid value for "billing_address", the character length must be great than or equal to 50.')
|
183
|
-
end
|
184
|
-
|
185
181
|
if @status.nil?
|
186
182
|
invalid_properties.push('invalid value for "status", status cannot be nil.')
|
187
183
|
end
|
@@ -209,7 +205,6 @@ module TogaiClient
|
|
209
205
|
return false if @primary_email.to_s.length > 255
|
210
206
|
return false if @billing_address.nil?
|
211
207
|
return false if @billing_address.to_s.length > 1000
|
212
|
-
return false if @billing_address.to_s.length < 50
|
213
208
|
return false if @status.nil?
|
214
209
|
status_validator = EnumAttributeValidator.new('String', ["ACTIVE", "ARCHIVED"])
|
215
210
|
return false unless status_validator.valid?(@status)
|
@@ -275,10 +270,6 @@ module TogaiClient
|
|
275
270
|
fail ArgumentError, 'invalid value for "billing_address", the character length must be smaller than or equal to 1000.'
|
276
271
|
end
|
277
272
|
|
278
|
-
if billing_address.to_s.length < 50
|
279
|
-
fail ArgumentError, 'invalid value for "billing_address", the character length must be great than or equal to 50.'
|
280
|
-
end
|
281
|
-
|
282
273
|
@billing_address = billing_address
|
283
274
|
end
|
284
275
|
|