pingram 1.0.1 → 1.0.3

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.
@@ -0,0 +1,330 @@
1
+ =begin
2
+ #Pingram
3
+
4
+ #Internal API for notification delivery and management
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.19.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module Pingram
17
+ # Response for GET /account/organization/usage
18
+ class OrganizationUsage < ApiModelBase
19
+ # Total message usage (EMAIL + INAPP_WEB + WEB_PUSH + PUSH + SLACK)
20
+ attr_accessor :message_usage
21
+
22
+ # Total budget usage in USD (cost_SMS + cost_CALL)
23
+ attr_accessor :budget_usage
24
+
25
+ # SMS cost in USD
26
+ attr_accessor :cost_sms
27
+
28
+ # Call cost in USD
29
+ attr_accessor :cost_call
30
+
31
+ # Per-channel usage breakdown
32
+ attr_accessor :channel_usages
33
+
34
+ # Billing cycle start date (ISO string)
35
+ attr_accessor :billing_cycle_start
36
+
37
+ # Billing cycle end date (ISO string)
38
+ attr_accessor :billing_cycle_end
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'message_usage' => :'messageUsage',
44
+ :'budget_usage' => :'budgetUsage',
45
+ :'cost_sms' => :'costSms',
46
+ :'cost_call' => :'costCall',
47
+ :'channel_usages' => :'channelUsages',
48
+ :'billing_cycle_start' => :'billingCycleStart',
49
+ :'billing_cycle_end' => :'billingCycleEnd'
50
+ }
51
+ end
52
+
53
+ # Returns attribute mapping this model knows about
54
+ def self.acceptable_attribute_map
55
+ attribute_map
56
+ end
57
+
58
+ # Returns all the JSON keys this model knows about
59
+ def self.acceptable_attributes
60
+ acceptable_attribute_map.values
61
+ end
62
+
63
+ # Attribute type mapping.
64
+ def self.openapi_types
65
+ {
66
+ :'message_usage' => :'Float',
67
+ :'budget_usage' => :'Float',
68
+ :'cost_sms' => :'Float',
69
+ :'cost_call' => :'Float',
70
+ :'channel_usages' => :'Hash<String, Float>',
71
+ :'billing_cycle_start' => :'String',
72
+ :'billing_cycle_end' => :'String'
73
+ }
74
+ end
75
+
76
+ # List of attributes with nullable: true
77
+ def self.openapi_nullable
78
+ Set.new([
79
+ ])
80
+ end
81
+
82
+ # Initializes the object
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ def initialize(attributes = {})
85
+ if (!attributes.is_a?(Hash))
86
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::OrganizationUsage` initialize method"
87
+ end
88
+
89
+ # check to see if the attribute exists and convert string to symbol for hash key
90
+ acceptable_attribute_map = self.class.acceptable_attribute_map
91
+ attributes = attributes.each_with_object({}) { |(k, v), h|
92
+ if (!acceptable_attribute_map.key?(k.to_sym))
93
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::OrganizationUsage`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
94
+ end
95
+ h[k.to_sym] = v
96
+ }
97
+
98
+ if attributes.key?(:'message_usage')
99
+ self.message_usage = attributes[:'message_usage']
100
+ else
101
+ self.message_usage = nil
102
+ end
103
+
104
+ if attributes.key?(:'budget_usage')
105
+ self.budget_usage = attributes[:'budget_usage']
106
+ else
107
+ self.budget_usage = nil
108
+ end
109
+
110
+ if attributes.key?(:'cost_sms')
111
+ self.cost_sms = attributes[:'cost_sms']
112
+ else
113
+ self.cost_sms = nil
114
+ end
115
+
116
+ if attributes.key?(:'cost_call')
117
+ self.cost_call = attributes[:'cost_call']
118
+ else
119
+ self.cost_call = nil
120
+ end
121
+
122
+ if attributes.key?(:'channel_usages')
123
+ if (value = attributes[:'channel_usages']).is_a?(Hash)
124
+ self.channel_usages = value
125
+ end
126
+ else
127
+ self.channel_usages = nil
128
+ end
129
+
130
+ if attributes.key?(:'billing_cycle_start')
131
+ self.billing_cycle_start = attributes[:'billing_cycle_start']
132
+ else
133
+ self.billing_cycle_start = nil
134
+ end
135
+
136
+ if attributes.key?(:'billing_cycle_end')
137
+ self.billing_cycle_end = attributes[:'billing_cycle_end']
138
+ else
139
+ self.billing_cycle_end = nil
140
+ end
141
+ end
142
+
143
+ # Show invalid properties with the reasons. Usually used together with valid?
144
+ # @return Array for valid properties with the reasons
145
+ def list_invalid_properties
146
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
147
+ invalid_properties = Array.new
148
+ if @message_usage.nil?
149
+ invalid_properties.push('invalid value for "message_usage", message_usage cannot be nil.')
150
+ end
151
+
152
+ if @budget_usage.nil?
153
+ invalid_properties.push('invalid value for "budget_usage", budget_usage cannot be nil.')
154
+ end
155
+
156
+ if @cost_sms.nil?
157
+ invalid_properties.push('invalid value for "cost_sms", cost_sms cannot be nil.')
158
+ end
159
+
160
+ if @cost_call.nil?
161
+ invalid_properties.push('invalid value for "cost_call", cost_call cannot be nil.')
162
+ end
163
+
164
+ if @channel_usages.nil?
165
+ invalid_properties.push('invalid value for "channel_usages", channel_usages cannot be nil.')
166
+ end
167
+
168
+ if @billing_cycle_start.nil?
169
+ invalid_properties.push('invalid value for "billing_cycle_start", billing_cycle_start cannot be nil.')
170
+ end
171
+
172
+ if @billing_cycle_end.nil?
173
+ invalid_properties.push('invalid value for "billing_cycle_end", billing_cycle_end cannot be nil.')
174
+ end
175
+
176
+ invalid_properties
177
+ end
178
+
179
+ # Check to see if the all the properties in the model are valid
180
+ # @return true if the model is valid
181
+ def valid?
182
+ warn '[DEPRECATED] the `valid?` method is obsolete'
183
+ return false if @message_usage.nil?
184
+ return false if @budget_usage.nil?
185
+ return false if @cost_sms.nil?
186
+ return false if @cost_call.nil?
187
+ return false if @channel_usages.nil?
188
+ return false if @billing_cycle_start.nil?
189
+ return false if @billing_cycle_end.nil?
190
+ true
191
+ end
192
+
193
+ # Custom attribute writer method with validation
194
+ # @param [Object] message_usage Value to be assigned
195
+ def message_usage=(message_usage)
196
+ if message_usage.nil?
197
+ fail ArgumentError, 'message_usage cannot be nil'
198
+ end
199
+
200
+ @message_usage = message_usage
201
+ end
202
+
203
+ # Custom attribute writer method with validation
204
+ # @param [Object] budget_usage Value to be assigned
205
+ def budget_usage=(budget_usage)
206
+ if budget_usage.nil?
207
+ fail ArgumentError, 'budget_usage cannot be nil'
208
+ end
209
+
210
+ @budget_usage = budget_usage
211
+ end
212
+
213
+ # Custom attribute writer method with validation
214
+ # @param [Object] cost_sms Value to be assigned
215
+ def cost_sms=(cost_sms)
216
+ if cost_sms.nil?
217
+ fail ArgumentError, 'cost_sms cannot be nil'
218
+ end
219
+
220
+ @cost_sms = cost_sms
221
+ end
222
+
223
+ # Custom attribute writer method with validation
224
+ # @param [Object] cost_call Value to be assigned
225
+ def cost_call=(cost_call)
226
+ if cost_call.nil?
227
+ fail ArgumentError, 'cost_call cannot be nil'
228
+ end
229
+
230
+ @cost_call = cost_call
231
+ end
232
+
233
+ # Custom attribute writer method with validation
234
+ # @param [Object] channel_usages Value to be assigned
235
+ def channel_usages=(channel_usages)
236
+ if channel_usages.nil?
237
+ fail ArgumentError, 'channel_usages cannot be nil'
238
+ end
239
+
240
+ @channel_usages = channel_usages
241
+ end
242
+
243
+ # Custom attribute writer method with validation
244
+ # @param [Object] billing_cycle_start Value to be assigned
245
+ def billing_cycle_start=(billing_cycle_start)
246
+ if billing_cycle_start.nil?
247
+ fail ArgumentError, 'billing_cycle_start cannot be nil'
248
+ end
249
+
250
+ @billing_cycle_start = billing_cycle_start
251
+ end
252
+
253
+ # Custom attribute writer method with validation
254
+ # @param [Object] billing_cycle_end Value to be assigned
255
+ def billing_cycle_end=(billing_cycle_end)
256
+ if billing_cycle_end.nil?
257
+ fail ArgumentError, 'billing_cycle_end cannot be nil'
258
+ end
259
+
260
+ @billing_cycle_end = billing_cycle_end
261
+ end
262
+
263
+ # Checks equality by comparing each attribute.
264
+ # @param [Object] Object to be compared
265
+ def ==(o)
266
+ return true if self.equal?(o)
267
+ self.class == o.class &&
268
+ message_usage == o.message_usage &&
269
+ budget_usage == o.budget_usage &&
270
+ cost_sms == o.cost_sms &&
271
+ cost_call == o.cost_call &&
272
+ channel_usages == o.channel_usages &&
273
+ billing_cycle_start == o.billing_cycle_start &&
274
+ billing_cycle_end == o.billing_cycle_end
275
+ end
276
+
277
+ # @see the `==` method
278
+ # @param [Object] Object to be compared
279
+ def eql?(o)
280
+ self == o
281
+ end
282
+
283
+ # Calculates hash code according to all attributes.
284
+ # @return [Integer] Hash code
285
+ def hash
286
+ [message_usage, budget_usage, cost_sms, cost_call, channel_usages, billing_cycle_start, billing_cycle_end].hash
287
+ end
288
+
289
+ # Builds the object from hash
290
+ # @param [Hash] attributes Model attributes in the form of hash
291
+ # @return [Object] Returns the model itself
292
+ def self.build_from_hash(attributes)
293
+ return nil unless attributes.is_a?(Hash)
294
+ attributes = attributes.transform_keys(&:to_sym)
295
+ transformed_hash = {}
296
+ openapi_types.each_pair do |key, type|
297
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
298
+ transformed_hash["#{key}"] = nil
299
+ elsif type =~ /\AArray<(.*)>/i
300
+ # check to ensure the input is an array given that the attribute
301
+ # is documented as an array but the input is not
302
+ if attributes[attribute_map[key]].is_a?(Array)
303
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
304
+ end
305
+ elsif !attributes[attribute_map[key]].nil?
306
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
307
+ end
308
+ end
309
+ new(transformed_hash)
310
+ end
311
+
312
+ # Returns the object in the form of hash
313
+ # @return [Hash] Returns the object in the form of hash
314
+ def to_hash
315
+ hash = {}
316
+ self.class.attribute_map.each_pair do |attr, param|
317
+ value = self.send(attr)
318
+ if value.nil?
319
+ is_nullable = self.class.openapi_nullable.include?(attr)
320
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
321
+ end
322
+
323
+ hash[param] = _to_hash(value)
324
+ end
325
+ hash
326
+ end
327
+
328
+ end
329
+
330
+ end
@@ -14,32 +14,15 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Pingram
17
- # Optional new usage limits to apply when downgrade takes effect
18
- class BillingPostResponseBodyPendingDowngradeUsageLimit < ApiModelBase
19
- attr_accessor :email
20
-
21
- attr_accessor :inapp_web
22
-
23
- attr_accessor :sms
24
-
25
- attr_accessor :call
26
-
27
- attr_accessor :push
28
-
29
- attr_accessor :web_push
30
-
31
- attr_accessor :slack
17
+ # Response for GET /organization/usage/history
18
+ class OrganizationUsageHistory < ApiModelBase
19
+ # Array of usage items, one per month in the requested range
20
+ attr_accessor :items
32
21
 
33
22
  # Attribute mapping from ruby-style variable name to JSON key.
34
23
  def self.attribute_map
35
24
  {
36
- :'email' => :'EMAIL',
37
- :'inapp_web' => :'INAPP_WEB',
38
- :'sms' => :'SMS',
39
- :'call' => :'CALL',
40
- :'push' => :'PUSH',
41
- :'web_push' => :'WEB_PUSH',
42
- :'slack' => :'SLACK'
25
+ :'items' => :'items'
43
26
  }
44
27
  end
45
28
 
@@ -56,13 +39,7 @@ module Pingram
56
39
  # Attribute type mapping.
57
40
  def self.openapi_types
58
41
  {
59
- :'email' => :'Float',
60
- :'inapp_web' => :'Float',
61
- :'sms' => :'Float',
62
- :'call' => :'Float',
63
- :'push' => :'Float',
64
- :'web_push' => :'Float',
65
- :'slack' => :'Float'
42
+ :'items' => :'Array<OrganizationUsageHistoryItemsInner>'
66
43
  }
67
44
  end
68
45
 
@@ -76,44 +53,24 @@ module Pingram
76
53
  # @param [Hash] attributes Model attributes in the form of hash
77
54
  def initialize(attributes = {})
78
55
  if (!attributes.is_a?(Hash))
79
- fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::BillingPostResponseBodyPendingDowngradeUsageLimit` initialize method"
56
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::OrganizationUsageHistory` initialize method"
80
57
  end
81
58
 
82
59
  # check to see if the attribute exists and convert string to symbol for hash key
83
60
  acceptable_attribute_map = self.class.acceptable_attribute_map
84
61
  attributes = attributes.each_with_object({}) { |(k, v), h|
85
62
  if (!acceptable_attribute_map.key?(k.to_sym))
86
- fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::BillingPostResponseBodyPendingDowngradeUsageLimit`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
63
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::OrganizationUsageHistory`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
87
64
  end
88
65
  h[k.to_sym] = v
89
66
  }
90
67
 
91
- if attributes.key?(:'email')
92
- self.email = attributes[:'email']
93
- end
94
-
95
- if attributes.key?(:'inapp_web')
96
- self.inapp_web = attributes[:'inapp_web']
97
- end
98
-
99
- if attributes.key?(:'sms')
100
- self.sms = attributes[:'sms']
101
- end
102
-
103
- if attributes.key?(:'call')
104
- self.call = attributes[:'call']
105
- end
106
-
107
- if attributes.key?(:'push')
108
- self.push = attributes[:'push']
109
- end
110
-
111
- if attributes.key?(:'web_push')
112
- self.web_push = attributes[:'web_push']
113
- end
114
-
115
- if attributes.key?(:'slack')
116
- self.slack = attributes[:'slack']
68
+ if attributes.key?(:'items')
69
+ if (value = attributes[:'items']).is_a?(Array)
70
+ self.items = value
71
+ end
72
+ else
73
+ self.items = nil
117
74
  end
118
75
  end
119
76
 
@@ -122,6 +79,10 @@ module Pingram
122
79
  def list_invalid_properties
123
80
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
124
81
  invalid_properties = Array.new
82
+ if @items.nil?
83
+ invalid_properties.push('invalid value for "items", items cannot be nil.')
84
+ end
85
+
125
86
  invalid_properties
126
87
  end
127
88
 
@@ -129,21 +90,26 @@ module Pingram
129
90
  # @return true if the model is valid
130
91
  def valid?
131
92
  warn '[DEPRECATED] the `valid?` method is obsolete'
93
+ return false if @items.nil?
132
94
  true
133
95
  end
134
96
 
97
+ # Custom attribute writer method with validation
98
+ # @param [Object] items Value to be assigned
99
+ def items=(items)
100
+ if items.nil?
101
+ fail ArgumentError, 'items cannot be nil'
102
+ end
103
+
104
+ @items = items
105
+ end
106
+
135
107
  # Checks equality by comparing each attribute.
136
108
  # @param [Object] Object to be compared
137
109
  def ==(o)
138
110
  return true if self.equal?(o)
139
111
  self.class == o.class &&
140
- email == o.email &&
141
- inapp_web == o.inapp_web &&
142
- sms == o.sms &&
143
- call == o.call &&
144
- push == o.push &&
145
- web_push == o.web_push &&
146
- slack == o.slack
112
+ items == o.items
147
113
  end
148
114
 
149
115
  # @see the `==` method
@@ -155,7 +121,7 @@ module Pingram
155
121
  # Calculates hash code according to all attributes.
156
122
  # @return [Integer] Hash code
157
123
  def hash
158
- [email, inapp_web, sms, call, push, web_push, slack].hash
124
+ [items].hash
159
125
  end
160
126
 
161
127
  # Builds the object from hash