pingram 1.0.10 → 1.0.11

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7159973c03bf987933bce4476148995727426c5a1105a3872dec4f574291d63
4
- data.tar.gz: baf82b4097f06f31e86572db6cec2f013734a38612299792bb5f22ebede45d9a
3
+ metadata.gz: 3f2eb2a3bf5cc0ac15624218064f63c512eafb93d0695f2df84f8c95990ddf4e
4
+ data.tar.gz: 35ffdb54bb14e8ae2f5a4a4c0da537715de2b5d4b5600bf193f771ecda10278c
5
5
  SHA512:
6
- metadata.gz: '038a44baf81ffe7b07d8080470ccd42e3fd41b77f1da3745e9eecb06ecacc7b66387a57a7b3d05bd11582cd74d65bb2d2648dbd3b8b6ea6230bd086b70144c81'
7
- data.tar.gz: 115cf1ae4ad623fdba7fa66cd345c666b7190d1fa50a254fe8d9d999f550fcf5a53daa2be8eeaee81488773f88e6756e56be5935b254758765ac4c9f7b9a4455
6
+ metadata.gz: d47b6b983521d1ae39b4168f0cf3aa129b264fe9845f0daa8a891a3e2deb20bd8e218a78f700756b6fc5a9a9dc31b73948067d684d3b7302520c577b6f3e77e1
7
+ data.tar.gz: 568d874bc0b12b9a07ddab8a759bb0f0aaa8d96ec24cc10eb71524d54bc679da5cde7aa2184d77b51cad2b36d6ba55a9a51c5aedd35646a437af9468658eaa1c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pingram (1.0.10)
4
+ pingram (1.0.11)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -32,7 +32,7 @@ module Pingram
32
32
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
33
33
  def initialize(config = Configuration.default)
34
34
  @config = config
35
- @user_agent = "pingram-ruby/1.0.10"
35
+ @user_agent = "pingram-ruby/1.0.11"
36
36
  @default_headers = {
37
37
  'Content-Type' => 'application/json',
38
38
  'User-Agent' => @user_agent
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative 'api_client'
8
8
  require_relative 'configuration'
9
+ require_relative 'webhooks'
9
10
 
10
11
  require_relative 'api/account_api'
11
12
 
@@ -58,6 +59,14 @@ require_relative 'api/webhooks_api'
58
59
 
59
60
  module Pingram
60
61
  # High-level Pingram client: holds API key and base URL, exposes tag APIs and +send+.
62
+ #
63
+ # @example Webhook verification
64
+ # event = Pingram::WebhookVerification.construct_event(
65
+ # payload: request.body.read,
66
+ # signature: request.env['HTTP_X_PINGRAM_SIGNATURE'],
67
+ # timestamp: request.env['HTTP_X_PINGRAM_TIMESTAMP'],
68
+ # secret: ENV['PINGRAM_WEBHOOK_SECRET']
69
+ # )
61
70
  class Client
62
71
  # @return [String] API key (e.g. pingram_sk_...)
63
72
  attr_reader :api_key
@@ -0,0 +1,512 @@
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
+ # Public response type for A2P registration - excludes internal Telnyx IDs
18
+ class A2pRegistration < ApiModelBase
19
+ attr_accessor :account_id
20
+
21
+ attr_accessor :scenario_id
22
+
23
+ attr_accessor :business_type
24
+
25
+ attr_accessor :legal_name
26
+
27
+ attr_accessor :tax_id
28
+
29
+ attr_accessor :website
30
+
31
+ attr_accessor :country
32
+
33
+ attr_accessor :full_address
34
+
35
+ attr_accessor :compliance_contact_email
36
+
37
+ attr_accessor :compliance_contact_phone
38
+
39
+ attr_accessor :brand_status
40
+
41
+ attr_accessor :campaign_status
42
+
43
+ attr_accessor :created_at
44
+
45
+ attr_accessor :updated_at
46
+
47
+ class EnumAttributeValidator
48
+ attr_reader :datatype
49
+ attr_reader :allowable_values
50
+
51
+ def initialize(datatype, allowable_values)
52
+ @allowable_values = allowable_values.map do |value|
53
+ case datatype.to_s
54
+ when /Integer/i
55
+ value.to_i
56
+ when /Float/i
57
+ value.to_f
58
+ else
59
+ value
60
+ end
61
+ end
62
+ end
63
+
64
+ def valid?(value)
65
+ !value || allowable_values.include?(value)
66
+ end
67
+ end
68
+
69
+ # Attribute mapping from ruby-style variable name to JSON key.
70
+ def self.attribute_map
71
+ {
72
+ :'account_id' => :'accountId',
73
+ :'scenario_id' => :'scenarioId',
74
+ :'business_type' => :'businessType',
75
+ :'legal_name' => :'legalName',
76
+ :'tax_id' => :'taxId',
77
+ :'website' => :'website',
78
+ :'country' => :'country',
79
+ :'full_address' => :'fullAddress',
80
+ :'compliance_contact_email' => :'complianceContactEmail',
81
+ :'compliance_contact_phone' => :'complianceContactPhone',
82
+ :'brand_status' => :'brandStatus',
83
+ :'campaign_status' => :'campaignStatus',
84
+ :'created_at' => :'createdAt',
85
+ :'updated_at' => :'updatedAt'
86
+ }
87
+ end
88
+
89
+ # Returns attribute mapping this model knows about
90
+ def self.acceptable_attribute_map
91
+ attribute_map
92
+ end
93
+
94
+ # Returns all the JSON keys this model knows about
95
+ def self.acceptable_attributes
96
+ acceptable_attribute_map.values
97
+ end
98
+
99
+ # Attribute type mapping.
100
+ def self.openapi_types
101
+ {
102
+ :'account_id' => :'String',
103
+ :'scenario_id' => :'String',
104
+ :'business_type' => :'String',
105
+ :'legal_name' => :'String',
106
+ :'tax_id' => :'String',
107
+ :'website' => :'String',
108
+ :'country' => :'String',
109
+ :'full_address' => :'String',
110
+ :'compliance_contact_email' => :'String',
111
+ :'compliance_contact_phone' => :'String',
112
+ :'brand_status' => :'String',
113
+ :'campaign_status' => :'String',
114
+ :'created_at' => :'String',
115
+ :'updated_at' => :'String'
116
+ }
117
+ end
118
+
119
+ # List of attributes with nullable: true
120
+ def self.openapi_nullable
121
+ Set.new([
122
+ ])
123
+ end
124
+
125
+ # Initializes the object
126
+ # @param [Hash] attributes Model attributes in the form of hash
127
+ def initialize(attributes = {})
128
+ if (!attributes.is_a?(Hash))
129
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::A2pRegistration` initialize method"
130
+ end
131
+
132
+ # check to see if the attribute exists and convert string to symbol for hash key
133
+ acceptable_attribute_map = self.class.acceptable_attribute_map
134
+ attributes = attributes.each_with_object({}) { |(k, v), h|
135
+ if (!acceptable_attribute_map.key?(k.to_sym))
136
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::A2pRegistration`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
137
+ end
138
+ h[k.to_sym] = v
139
+ }
140
+
141
+ if attributes.key?(:'account_id')
142
+ self.account_id = attributes[:'account_id']
143
+ else
144
+ self.account_id = nil
145
+ end
146
+
147
+ if attributes.key?(:'scenario_id')
148
+ self.scenario_id = attributes[:'scenario_id']
149
+ else
150
+ self.scenario_id = nil
151
+ end
152
+
153
+ if attributes.key?(:'business_type')
154
+ self.business_type = attributes[:'business_type']
155
+ else
156
+ self.business_type = nil
157
+ end
158
+
159
+ if attributes.key?(:'legal_name')
160
+ self.legal_name = attributes[:'legal_name']
161
+ else
162
+ self.legal_name = nil
163
+ end
164
+
165
+ if attributes.key?(:'tax_id')
166
+ self.tax_id = attributes[:'tax_id']
167
+ end
168
+
169
+ if attributes.key?(:'website')
170
+ self.website = attributes[:'website']
171
+ else
172
+ self.website = nil
173
+ end
174
+
175
+ if attributes.key?(:'country')
176
+ self.country = attributes[:'country']
177
+ else
178
+ self.country = nil
179
+ end
180
+
181
+ if attributes.key?(:'full_address')
182
+ self.full_address = attributes[:'full_address']
183
+ else
184
+ self.full_address = nil
185
+ end
186
+
187
+ if attributes.key?(:'compliance_contact_email')
188
+ self.compliance_contact_email = attributes[:'compliance_contact_email']
189
+ else
190
+ self.compliance_contact_email = nil
191
+ end
192
+
193
+ if attributes.key?(:'compliance_contact_phone')
194
+ self.compliance_contact_phone = attributes[:'compliance_contact_phone']
195
+ else
196
+ self.compliance_contact_phone = nil
197
+ end
198
+
199
+ if attributes.key?(:'brand_status')
200
+ self.brand_status = attributes[:'brand_status']
201
+ else
202
+ self.brand_status = nil
203
+ end
204
+
205
+ if attributes.key?(:'campaign_status')
206
+ self.campaign_status = attributes[:'campaign_status']
207
+ else
208
+ self.campaign_status = nil
209
+ end
210
+
211
+ if attributes.key?(:'created_at')
212
+ self.created_at = attributes[:'created_at']
213
+ else
214
+ self.created_at = nil
215
+ end
216
+
217
+ if attributes.key?(:'updated_at')
218
+ self.updated_at = attributes[:'updated_at']
219
+ else
220
+ self.updated_at = nil
221
+ end
222
+ end
223
+
224
+ # Show invalid properties with the reasons. Usually used together with valid?
225
+ # @return Array for valid properties with the reasons
226
+ def list_invalid_properties
227
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
228
+ invalid_properties = Array.new
229
+ if @account_id.nil?
230
+ invalid_properties.push('invalid value for "account_id", account_id cannot be nil.')
231
+ end
232
+
233
+ if @scenario_id.nil?
234
+ invalid_properties.push('invalid value for "scenario_id", scenario_id cannot be nil.')
235
+ end
236
+
237
+ if @business_type.nil?
238
+ invalid_properties.push('invalid value for "business_type", business_type cannot be nil.')
239
+ end
240
+
241
+ if @legal_name.nil?
242
+ invalid_properties.push('invalid value for "legal_name", legal_name cannot be nil.')
243
+ end
244
+
245
+ if @website.nil?
246
+ invalid_properties.push('invalid value for "website", website cannot be nil.')
247
+ end
248
+
249
+ if @country.nil?
250
+ invalid_properties.push('invalid value for "country", country cannot be nil.')
251
+ end
252
+
253
+ if @full_address.nil?
254
+ invalid_properties.push('invalid value for "full_address", full_address cannot be nil.')
255
+ end
256
+
257
+ if @compliance_contact_email.nil?
258
+ invalid_properties.push('invalid value for "compliance_contact_email", compliance_contact_email cannot be nil.')
259
+ end
260
+
261
+ if @compliance_contact_phone.nil?
262
+ invalid_properties.push('invalid value for "compliance_contact_phone", compliance_contact_phone cannot be nil.')
263
+ end
264
+
265
+ if @brand_status.nil?
266
+ invalid_properties.push('invalid value for "brand_status", brand_status cannot be nil.')
267
+ end
268
+
269
+ if @campaign_status.nil?
270
+ invalid_properties.push('invalid value for "campaign_status", campaign_status cannot be nil.')
271
+ end
272
+
273
+ if @created_at.nil?
274
+ invalid_properties.push('invalid value for "created_at", created_at cannot be nil.')
275
+ end
276
+
277
+ if @updated_at.nil?
278
+ invalid_properties.push('invalid value for "updated_at", updated_at cannot be nil.')
279
+ end
280
+
281
+ invalid_properties
282
+ end
283
+
284
+ # Check to see if the all the properties in the model are valid
285
+ # @return true if the model is valid
286
+ def valid?
287
+ warn '[DEPRECATED] the `valid?` method is obsolete'
288
+ return false if @account_id.nil?
289
+ return false if @scenario_id.nil?
290
+ return false if @business_type.nil?
291
+ return false if @legal_name.nil?
292
+ return false if @website.nil?
293
+ return false if @country.nil?
294
+ return false if @full_address.nil?
295
+ return false if @compliance_contact_email.nil?
296
+ return false if @compliance_contact_phone.nil?
297
+ return false if @brand_status.nil?
298
+ brand_status_validator = EnumAttributeValidator.new('String', ["not_started", "in_progress", "pending_review", "approved", "rejected", "info_needed"])
299
+ return false unless brand_status_validator.valid?(@brand_status)
300
+ return false if @campaign_status.nil?
301
+ campaign_status_validator = EnumAttributeValidator.new('String', ["not_started", "in_progress", "pending_review", "approved", "rejected", "info_needed"])
302
+ return false unless campaign_status_validator.valid?(@campaign_status)
303
+ return false if @created_at.nil?
304
+ return false if @updated_at.nil?
305
+ true
306
+ end
307
+
308
+ # Custom attribute writer method with validation
309
+ # @param [Object] account_id Value to be assigned
310
+ def account_id=(account_id)
311
+ if account_id.nil?
312
+ fail ArgumentError, 'account_id cannot be nil'
313
+ end
314
+
315
+ @account_id = account_id
316
+ end
317
+
318
+ # Custom attribute writer method with validation
319
+ # @param [Object] scenario_id Value to be assigned
320
+ def scenario_id=(scenario_id)
321
+ if scenario_id.nil?
322
+ fail ArgumentError, 'scenario_id cannot be nil'
323
+ end
324
+
325
+ @scenario_id = scenario_id
326
+ end
327
+
328
+ # Custom attribute writer method with validation
329
+ # @param [Object] business_type Value to be assigned
330
+ def business_type=(business_type)
331
+ if business_type.nil?
332
+ fail ArgumentError, 'business_type cannot be nil'
333
+ end
334
+
335
+ @business_type = business_type
336
+ end
337
+
338
+ # Custom attribute writer method with validation
339
+ # @param [Object] legal_name Value to be assigned
340
+ def legal_name=(legal_name)
341
+ if legal_name.nil?
342
+ fail ArgumentError, 'legal_name cannot be nil'
343
+ end
344
+
345
+ @legal_name = legal_name
346
+ end
347
+
348
+ # Custom attribute writer method with validation
349
+ # @param [Object] website Value to be assigned
350
+ def website=(website)
351
+ if website.nil?
352
+ fail ArgumentError, 'website cannot be nil'
353
+ end
354
+
355
+ @website = website
356
+ end
357
+
358
+ # Custom attribute writer method with validation
359
+ # @param [Object] country Value to be assigned
360
+ def country=(country)
361
+ if country.nil?
362
+ fail ArgumentError, 'country cannot be nil'
363
+ end
364
+
365
+ @country = country
366
+ end
367
+
368
+ # Custom attribute writer method with validation
369
+ # @param [Object] full_address Value to be assigned
370
+ def full_address=(full_address)
371
+ if full_address.nil?
372
+ fail ArgumentError, 'full_address cannot be nil'
373
+ end
374
+
375
+ @full_address = full_address
376
+ end
377
+
378
+ # Custom attribute writer method with validation
379
+ # @param [Object] compliance_contact_email Value to be assigned
380
+ def compliance_contact_email=(compliance_contact_email)
381
+ if compliance_contact_email.nil?
382
+ fail ArgumentError, 'compliance_contact_email cannot be nil'
383
+ end
384
+
385
+ @compliance_contact_email = compliance_contact_email
386
+ end
387
+
388
+ # Custom attribute writer method with validation
389
+ # @param [Object] compliance_contact_phone Value to be assigned
390
+ def compliance_contact_phone=(compliance_contact_phone)
391
+ if compliance_contact_phone.nil?
392
+ fail ArgumentError, 'compliance_contact_phone cannot be nil'
393
+ end
394
+
395
+ @compliance_contact_phone = compliance_contact_phone
396
+ end
397
+
398
+ # Custom attribute writer method checking allowed values (enum).
399
+ # @param [Object] brand_status Object to be assigned
400
+ def brand_status=(brand_status)
401
+ validator = EnumAttributeValidator.new('String', ["not_started", "in_progress", "pending_review", "approved", "rejected", "info_needed"])
402
+ unless validator.valid?(brand_status)
403
+ fail ArgumentError, "invalid value for \"brand_status\", must be one of #{validator.allowable_values}."
404
+ end
405
+ @brand_status = brand_status
406
+ end
407
+
408
+ # Custom attribute writer method checking allowed values (enum).
409
+ # @param [Object] campaign_status Object to be assigned
410
+ def campaign_status=(campaign_status)
411
+ validator = EnumAttributeValidator.new('String', ["not_started", "in_progress", "pending_review", "approved", "rejected", "info_needed"])
412
+ unless validator.valid?(campaign_status)
413
+ fail ArgumentError, "invalid value for \"campaign_status\", must be one of #{validator.allowable_values}."
414
+ end
415
+ @campaign_status = campaign_status
416
+ end
417
+
418
+ # Custom attribute writer method with validation
419
+ # @param [Object] created_at Value to be assigned
420
+ def created_at=(created_at)
421
+ if created_at.nil?
422
+ fail ArgumentError, 'created_at cannot be nil'
423
+ end
424
+
425
+ @created_at = created_at
426
+ end
427
+
428
+ # Custom attribute writer method with validation
429
+ # @param [Object] updated_at Value to be assigned
430
+ def updated_at=(updated_at)
431
+ if updated_at.nil?
432
+ fail ArgumentError, 'updated_at cannot be nil'
433
+ end
434
+
435
+ @updated_at = updated_at
436
+ end
437
+
438
+ # Checks equality by comparing each attribute.
439
+ # @param [Object] Object to be compared
440
+ def ==(o)
441
+ return true if self.equal?(o)
442
+ self.class == o.class &&
443
+ account_id == o.account_id &&
444
+ scenario_id == o.scenario_id &&
445
+ business_type == o.business_type &&
446
+ legal_name == o.legal_name &&
447
+ tax_id == o.tax_id &&
448
+ website == o.website &&
449
+ country == o.country &&
450
+ full_address == o.full_address &&
451
+ compliance_contact_email == o.compliance_contact_email &&
452
+ compliance_contact_phone == o.compliance_contact_phone &&
453
+ brand_status == o.brand_status &&
454
+ campaign_status == o.campaign_status &&
455
+ created_at == o.created_at &&
456
+ updated_at == o.updated_at
457
+ end
458
+
459
+ # @see the `==` method
460
+ # @param [Object] Object to be compared
461
+ def eql?(o)
462
+ self == o
463
+ end
464
+
465
+ # Calculates hash code according to all attributes.
466
+ # @return [Integer] Hash code
467
+ def hash
468
+ [account_id, scenario_id, business_type, legal_name, tax_id, website, country, full_address, compliance_contact_email, compliance_contact_phone, brand_status, campaign_status, created_at, updated_at].hash
469
+ end
470
+
471
+ # Builds the object from hash
472
+ # @param [Hash] attributes Model attributes in the form of hash
473
+ # @return [Object] Returns the model itself
474
+ def self.build_from_hash(attributes)
475
+ return nil unless attributes.is_a?(Hash)
476
+ attributes = attributes.transform_keys(&:to_sym)
477
+ transformed_hash = {}
478
+ openapi_types.each_pair do |key, type|
479
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
480
+ transformed_hash["#{key}"] = nil
481
+ elsif type =~ /\AArray<(.*)>/i
482
+ # check to ensure the input is an array given that the attribute
483
+ # is documented as an array but the input is not
484
+ if attributes[attribute_map[key]].is_a?(Array)
485
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
486
+ end
487
+ elsif !attributes[attribute_map[key]].nil?
488
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
489
+ end
490
+ end
491
+ new(transformed_hash)
492
+ end
493
+
494
+ # Returns the object in the form of hash
495
+ # @return [Hash] Returns the object in the form of hash
496
+ def to_hash
497
+ hash = {}
498
+ self.class.attribute_map.each_pair do |attr, param|
499
+ value = self.send(attr)
500
+ if value.nil?
501
+ is_nullable = self.class.openapi_nullable.include?(attr)
502
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
503
+ end
504
+
505
+ hash[param] = _to_hash(value)
506
+ end
507
+ hash
508
+ end
509
+
510
+ end
511
+
512
+ end