pingram 1.0.0 → 1.0.2

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,234 @@
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
+ # Events webhook configuration returned by the API.
18
+ class EventsWebhookResponse < ApiModelBase
19
+ # Storage key in the format accountId:envId (currently accountId:accountId for account-scoped usage).
20
+ attr_accessor :webhook_id
21
+
22
+ # Destination URL that receives webhook event payloads.
23
+ attr_accessor :webhook
24
+
25
+ # List of subscribed event types for this webhook configuration.
26
+ attr_accessor :events
27
+
28
+ class EnumAttributeValidator
29
+ attr_reader :datatype
30
+ attr_reader :allowable_values
31
+
32
+ def initialize(datatype, allowable_values)
33
+ @allowable_values = allowable_values.map do |value|
34
+ case datatype.to_s
35
+ when /Integer/i
36
+ value.to_i
37
+ when /Float/i
38
+ value.to_f
39
+ else
40
+ value
41
+ end
42
+ end
43
+ end
44
+
45
+ def valid?(value)
46
+ !value || allowable_values.include?(value)
47
+ end
48
+ end
49
+
50
+ # Attribute mapping from ruby-style variable name to JSON key.
51
+ def self.attribute_map
52
+ {
53
+ :'webhook_id' => :'webhookId',
54
+ :'webhook' => :'webhook',
55
+ :'events' => :'events'
56
+ }
57
+ end
58
+
59
+ # Returns attribute mapping this model knows about
60
+ def self.acceptable_attribute_map
61
+ attribute_map
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ acceptable_attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'webhook_id' => :'String',
73
+ :'webhook' => :'String',
74
+ :'events' => :'Array<String>'
75
+ }
76
+ end
77
+
78
+ # List of attributes with nullable: true
79
+ def self.openapi_nullable
80
+ Set.new([
81
+ ])
82
+ end
83
+
84
+ # Initializes the object
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ def initialize(attributes = {})
87
+ if (!attributes.is_a?(Hash))
88
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::EventsWebhookResponse` initialize method"
89
+ end
90
+
91
+ # check to see if the attribute exists and convert string to symbol for hash key
92
+ acceptable_attribute_map = self.class.acceptable_attribute_map
93
+ attributes = attributes.each_with_object({}) { |(k, v), h|
94
+ if (!acceptable_attribute_map.key?(k.to_sym))
95
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::EventsWebhookResponse`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
96
+ end
97
+ h[k.to_sym] = v
98
+ }
99
+
100
+ if attributes.key?(:'webhook_id')
101
+ self.webhook_id = attributes[:'webhook_id']
102
+ else
103
+ self.webhook_id = nil
104
+ end
105
+
106
+ if attributes.key?(:'webhook')
107
+ self.webhook = attributes[:'webhook']
108
+ else
109
+ self.webhook = nil
110
+ end
111
+
112
+ if attributes.key?(:'events')
113
+ if (value = attributes[:'events']).is_a?(Array)
114
+ self.events = value
115
+ end
116
+ else
117
+ self.events = nil
118
+ end
119
+ end
120
+
121
+ # Show invalid properties with the reasons. Usually used together with valid?
122
+ # @return Array for valid properties with the reasons
123
+ def list_invalid_properties
124
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
125
+ invalid_properties = Array.new
126
+ if @webhook_id.nil?
127
+ invalid_properties.push('invalid value for "webhook_id", webhook_id cannot be nil.')
128
+ end
129
+
130
+ if @webhook.nil?
131
+ invalid_properties.push('invalid value for "webhook", webhook cannot be nil.')
132
+ end
133
+
134
+ if @events.nil?
135
+ invalid_properties.push('invalid value for "events", events cannot be nil.')
136
+ end
137
+
138
+ invalid_properties
139
+ end
140
+
141
+ # Check to see if the all the properties in the model are valid
142
+ # @return true if the model is valid
143
+ def valid?
144
+ warn '[DEPRECATED] the `valid?` method is obsolete'
145
+ return false if @webhook_id.nil?
146
+ return false if @webhook.nil?
147
+ return false if @events.nil?
148
+ true
149
+ end
150
+
151
+ # Custom attribute writer method with validation
152
+ # @param [Object] webhook_id Value to be assigned
153
+ def webhook_id=(webhook_id)
154
+ if webhook_id.nil?
155
+ fail ArgumentError, 'webhook_id cannot be nil'
156
+ end
157
+
158
+ @webhook_id = webhook_id
159
+ end
160
+
161
+ # Custom attribute writer method with validation
162
+ # @param [Object] webhook Value to be assigned
163
+ def webhook=(webhook)
164
+ if webhook.nil?
165
+ fail ArgumentError, 'webhook cannot be nil'
166
+ end
167
+
168
+ @webhook = webhook
169
+ end
170
+
171
+ # Checks equality by comparing each attribute.
172
+ # @param [Object] Object to be compared
173
+ def ==(o)
174
+ return true if self.equal?(o)
175
+ self.class == o.class &&
176
+ webhook_id == o.webhook_id &&
177
+ webhook == o.webhook &&
178
+ events == o.events
179
+ end
180
+
181
+ # @see the `==` method
182
+ # @param [Object] Object to be compared
183
+ def eql?(o)
184
+ self == o
185
+ end
186
+
187
+ # Calculates hash code according to all attributes.
188
+ # @return [Integer] Hash code
189
+ def hash
190
+ [webhook_id, webhook, events].hash
191
+ end
192
+
193
+ # Builds the object from hash
194
+ # @param [Hash] attributes Model attributes in the form of hash
195
+ # @return [Object] Returns the model itself
196
+ def self.build_from_hash(attributes)
197
+ return nil unless attributes.is_a?(Hash)
198
+ attributes = attributes.transform_keys(&:to_sym)
199
+ transformed_hash = {}
200
+ openapi_types.each_pair do |key, type|
201
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
202
+ transformed_hash["#{key}"] = nil
203
+ elsif type =~ /\AArray<(.*)>/i
204
+ # check to ensure the input is an array given that the attribute
205
+ # is documented as an array but the input is not
206
+ if attributes[attribute_map[key]].is_a?(Array)
207
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
208
+ end
209
+ elsif !attributes[attribute_map[key]].nil?
210
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
211
+ end
212
+ end
213
+ new(transformed_hash)
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ end
233
+
234
+ end
@@ -0,0 +1,207 @@
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
+ # Request body for creating or updating the events webhook configuration.
18
+ class EventsWebhookUpsertRequest < ApiModelBase
19
+ # Destination URL that receives webhook event payloads. Must be a valid http(s) URL.
20
+ attr_accessor :webhook
21
+
22
+ # List of event types that should be forwarded to the webhook URL.
23
+ attr_accessor :events
24
+
25
+ class EnumAttributeValidator
26
+ attr_reader :datatype
27
+ attr_reader :allowable_values
28
+
29
+ def initialize(datatype, allowable_values)
30
+ @allowable_values = allowable_values.map do |value|
31
+ case datatype.to_s
32
+ when /Integer/i
33
+ value.to_i
34
+ when /Float/i
35
+ value.to_f
36
+ else
37
+ value
38
+ end
39
+ end
40
+ end
41
+
42
+ def valid?(value)
43
+ !value || allowable_values.include?(value)
44
+ end
45
+ end
46
+
47
+ # Attribute mapping from ruby-style variable name to JSON key.
48
+ def self.attribute_map
49
+ {
50
+ :'webhook' => :'webhook',
51
+ :'events' => :'events'
52
+ }
53
+ end
54
+
55
+ # Returns attribute mapping this model knows about
56
+ def self.acceptable_attribute_map
57
+ attribute_map
58
+ end
59
+
60
+ # Returns all the JSON keys this model knows about
61
+ def self.acceptable_attributes
62
+ acceptable_attribute_map.values
63
+ end
64
+
65
+ # Attribute type mapping.
66
+ def self.openapi_types
67
+ {
68
+ :'webhook' => :'String',
69
+ :'events' => :'Array<String>'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::EventsWebhookUpsertRequest` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ acceptable_attribute_map = self.class.acceptable_attribute_map
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!acceptable_attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::EventsWebhookUpsertRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
94
+
95
+ if attributes.key?(:'webhook')
96
+ self.webhook = attributes[:'webhook']
97
+ else
98
+ self.webhook = nil
99
+ end
100
+
101
+ if attributes.key?(:'events')
102
+ if (value = attributes[:'events']).is_a?(Array)
103
+ self.events = value
104
+ end
105
+ else
106
+ self.events = nil
107
+ end
108
+ end
109
+
110
+ # Show invalid properties with the reasons. Usually used together with valid?
111
+ # @return Array for valid properties with the reasons
112
+ def list_invalid_properties
113
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
114
+ invalid_properties = Array.new
115
+ if @webhook.nil?
116
+ invalid_properties.push('invalid value for "webhook", webhook cannot be nil.')
117
+ end
118
+
119
+ if @events.nil?
120
+ invalid_properties.push('invalid value for "events", events cannot be nil.')
121
+ end
122
+
123
+ invalid_properties
124
+ end
125
+
126
+ # Check to see if the all the properties in the model are valid
127
+ # @return true if the model is valid
128
+ def valid?
129
+ warn '[DEPRECATED] the `valid?` method is obsolete'
130
+ return false if @webhook.nil?
131
+ return false if @events.nil?
132
+ true
133
+ end
134
+
135
+ # Custom attribute writer method with validation
136
+ # @param [Object] webhook Value to be assigned
137
+ def webhook=(webhook)
138
+ if webhook.nil?
139
+ fail ArgumentError, 'webhook cannot be nil'
140
+ end
141
+
142
+ @webhook = webhook
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ webhook == o.webhook &&
151
+ events == o.events
152
+ end
153
+
154
+ # @see the `==` method
155
+ # @param [Object] Object to be compared
156
+ def eql?(o)
157
+ self == o
158
+ end
159
+
160
+ # Calculates hash code according to all attributes.
161
+ # @return [Integer] Hash code
162
+ def hash
163
+ [webhook, events].hash
164
+ end
165
+
166
+ # Builds the object from hash
167
+ # @param [Hash] attributes Model attributes in the form of hash
168
+ # @return [Object] Returns the model itself
169
+ def self.build_from_hash(attributes)
170
+ return nil unless attributes.is_a?(Hash)
171
+ attributes = attributes.transform_keys(&:to_sym)
172
+ transformed_hash = {}
173
+ openapi_types.each_pair do |key, type|
174
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
175
+ transformed_hash["#{key}"] = nil
176
+ elsif type =~ /\AArray<(.*)>/i
177
+ # check to ensure the input is an array given that the attribute
178
+ # is documented as an array but the input is not
179
+ if attributes[attribute_map[key]].is_a?(Array)
180
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
181
+ end
182
+ elsif !attributes[attribute_map[key]].nil?
183
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
184
+ end
185
+ end
186
+ new(transformed_hash)
187
+ end
188
+
189
+ # Returns the object in the form of hash
190
+ # @return [Hash] Returns the object in the form of hash
191
+ def to_hash
192
+ hash = {}
193
+ self.class.attribute_map.each_pair do |attr, param|
194
+ value = self.send(attr)
195
+ if value.nil?
196
+ is_nullable = self.class.openapi_nullable.include?(attr)
197
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
198
+ end
199
+
200
+ hash[param] = _to_hash(value)
201
+ end
202
+ hash
203
+ end
204
+
205
+ end
206
+
207
+ end
@@ -39,8 +39,6 @@ module Pingram
39
39
 
40
40
  attr_accessor :sender_email
41
41
 
42
- attr_accessor :migration
43
-
44
42
  class EnumAttributeValidator
45
43
  attr_reader :datatype
46
44
  attr_reader :allowable_values
@@ -77,8 +75,7 @@ module Pingram
77
75
  :'internal' => :'internal',
78
76
  :'subject' => :'subject',
79
77
  :'sender_name' => :'senderName',
80
- :'sender_email' => :'senderEmail',
81
- :'migration' => :'migration'
78
+ :'sender_email' => :'senderEmail'
82
79
  }
83
80
  end
84
81
 
@@ -106,8 +103,7 @@ module Pingram
106
103
  :'internal' => :'String',
107
104
  :'subject' => :'String',
108
105
  :'sender_name' => :'String',
109
- :'sender_email' => :'String',
110
- :'migration' => :'String'
106
+ :'sender_email' => :'String'
111
107
  }
112
108
  end
113
109
 
@@ -202,10 +198,6 @@ module Pingram
202
198
  else
203
199
  self.sender_email = nil
204
200
  end
205
-
206
- if attributes.key?(:'migration')
207
- self.migration = attributes[:'migration']
208
- end
209
201
  end
210
202
 
211
203
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -389,8 +381,7 @@ module Pingram
389
381
  internal == o.internal &&
390
382
  subject == o.subject &&
391
383
  sender_name == o.sender_name &&
392
- sender_email == o.sender_email &&
393
- migration == o.migration
384
+ sender_email == o.sender_email
394
385
  end
395
386
 
396
387
  # @see the `==` method
@@ -402,7 +393,7 @@ module Pingram
402
393
  # Calculates hash code according to all attributes.
403
394
  # @return [Integer] Hash code
404
395
  def hash
405
- [env_id, notification_id, template_id, channel, default, is_default_for, html, preview_text, internal, subject, sender_name, sender_email, migration].hash
396
+ [env_id, notification_id, template_id, channel, default, is_default_for, html, preview_text, internal, subject, sender_name, sender_email].hash
406
397
  end
407
398
 
408
399
  # Builds the object from hash
@@ -14,31 +14,19 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Pingram
17
- class AccountGetResponsePendingDowngradeUsageLimit < ApiModelBase
18
- attr_accessor :email
17
+ # Query parameters for GET /organization/usage/history
18
+ class GetUsageHistoryQuery < ApiModelBase
19
+ # Start date (YYYY-MM-DD) for the range
20
+ attr_accessor :start_date
19
21
 
20
- attr_accessor :inapp_web
21
-
22
- attr_accessor :sms
23
-
24
- attr_accessor :call
25
-
26
- attr_accessor :push
27
-
28
- attr_accessor :web_push
29
-
30
- attr_accessor :slack
22
+ # End date (YYYY-MM-DD) for the range
23
+ attr_accessor :end_date
31
24
 
32
25
  # Attribute mapping from ruby-style variable name to JSON key.
33
26
  def self.attribute_map
34
27
  {
35
- :'email' => :'EMAIL',
36
- :'inapp_web' => :'INAPP_WEB',
37
- :'sms' => :'SMS',
38
- :'call' => :'CALL',
39
- :'push' => :'PUSH',
40
- :'web_push' => :'WEB_PUSH',
41
- :'slack' => :'SLACK'
28
+ :'start_date' => :'startDate',
29
+ :'end_date' => :'endDate'
42
30
  }
43
31
  end
44
32
 
@@ -55,13 +43,8 @@ module Pingram
55
43
  # Attribute type mapping.
56
44
  def self.openapi_types
57
45
  {
58
- :'email' => :'Float',
59
- :'inapp_web' => :'Float',
60
- :'sms' => :'Float',
61
- :'call' => :'Float',
62
- :'push' => :'Float',
63
- :'web_push' => :'Float',
64
- :'slack' => :'Float'
46
+ :'start_date' => :'String',
47
+ :'end_date' => :'String'
65
48
  }
66
49
  end
67
50
 
@@ -75,44 +58,28 @@ module Pingram
75
58
  # @param [Hash] attributes Model attributes in the form of hash
76
59
  def initialize(attributes = {})
77
60
  if (!attributes.is_a?(Hash))
78
- fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::AccountGetResponsePendingDowngradeUsageLimit` initialize method"
61
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::GetUsageHistoryQuery` initialize method"
79
62
  end
80
63
 
81
64
  # check to see if the attribute exists and convert string to symbol for hash key
82
65
  acceptable_attribute_map = self.class.acceptable_attribute_map
83
66
  attributes = attributes.each_with_object({}) { |(k, v), h|
84
67
  if (!acceptable_attribute_map.key?(k.to_sym))
85
- fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::AccountGetResponsePendingDowngradeUsageLimit`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
68
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::GetUsageHistoryQuery`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
86
69
  end
87
70
  h[k.to_sym] = v
88
71
  }
89
72
 
90
- if attributes.key?(:'email')
91
- self.email = attributes[:'email']
92
- end
93
-
94
- if attributes.key?(:'inapp_web')
95
- self.inapp_web = attributes[:'inapp_web']
73
+ if attributes.key?(:'start_date')
74
+ self.start_date = attributes[:'start_date']
75
+ else
76
+ self.start_date = nil
96
77
  end
97
78
 
98
- if attributes.key?(:'sms')
99
- self.sms = attributes[:'sms']
100
- end
101
-
102
- if attributes.key?(:'call')
103
- self.call = attributes[:'call']
104
- end
105
-
106
- if attributes.key?(:'push')
107
- self.push = attributes[:'push']
108
- end
109
-
110
- if attributes.key?(:'web_push')
111
- self.web_push = attributes[:'web_push']
112
- end
113
-
114
- if attributes.key?(:'slack')
115
- self.slack = attributes[:'slack']
79
+ if attributes.key?(:'end_date')
80
+ self.end_date = attributes[:'end_date']
81
+ else
82
+ self.end_date = nil
116
83
  end
117
84
  end
118
85
 
@@ -121,6 +88,14 @@ module Pingram
121
88
  def list_invalid_properties
122
89
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
123
90
  invalid_properties = Array.new
91
+ if @start_date.nil?
92
+ invalid_properties.push('invalid value for "start_date", start_date cannot be nil.')
93
+ end
94
+
95
+ if @end_date.nil?
96
+ invalid_properties.push('invalid value for "end_date", end_date cannot be nil.')
97
+ end
98
+
124
99
  invalid_properties
125
100
  end
126
101
 
@@ -128,21 +103,38 @@ module Pingram
128
103
  # @return true if the model is valid
129
104
  def valid?
130
105
  warn '[DEPRECATED] the `valid?` method is obsolete'
106
+ return false if @start_date.nil?
107
+ return false if @end_date.nil?
131
108
  true
132
109
  end
133
110
 
111
+ # Custom attribute writer method with validation
112
+ # @param [Object] start_date Value to be assigned
113
+ def start_date=(start_date)
114
+ if start_date.nil?
115
+ fail ArgumentError, 'start_date cannot be nil'
116
+ end
117
+
118
+ @start_date = start_date
119
+ end
120
+
121
+ # Custom attribute writer method with validation
122
+ # @param [Object] end_date Value to be assigned
123
+ def end_date=(end_date)
124
+ if end_date.nil?
125
+ fail ArgumentError, 'end_date cannot be nil'
126
+ end
127
+
128
+ @end_date = end_date
129
+ end
130
+
134
131
  # Checks equality by comparing each attribute.
135
132
  # @param [Object] Object to be compared
136
133
  def ==(o)
137
134
  return true if self.equal?(o)
138
135
  self.class == o.class &&
139
- email == o.email &&
140
- inapp_web == o.inapp_web &&
141
- sms == o.sms &&
142
- call == o.call &&
143
- push == o.push &&
144
- web_push == o.web_push &&
145
- slack == o.slack
136
+ start_date == o.start_date &&
137
+ end_date == o.end_date
146
138
  end
147
139
 
148
140
  # @see the `==` method
@@ -154,7 +146,7 @@ module Pingram
154
146
  # Calculates hash code according to all attributes.
155
147
  # @return [Integer] Hash code
156
148
  def hash
157
- [email, inapp_web, sms, call, push, web_push, slack].hash
149
+ [start_date, end_date].hash
158
150
  end
159
151
 
160
152
  # Builds the object from hash