pingram 1.0.22 → 1.0.23

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.
Files changed (26) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +1 -1
  3. data/lib/pingram/api/accounts_api.rb +143 -0
  4. data/lib/pingram/api_client.rb +1 -1
  5. data/lib/pingram/client_wrapper.rb +10 -0
  6. data/lib/pingram/models/account_get_response.rb +25 -4
  7. data/lib/pingram/models/billing_post_response_body.rb +22 -1
  8. data/lib/pingram/models/create_account_request.rb +45 -9
  9. data/lib/pingram/models/create_account_request_plan.rb +216 -0
  10. data/lib/pingram/models/create_account_response.rb +103 -30
  11. data/lib/pingram/models/first_account_request.rb +150 -0
  12. data/lib/pingram/models/first_account_response.rb +190 -0
  13. data/lib/pingram/models/list_accounts_response.rb +167 -0
  14. data/lib/pingram/models/list_accounts_response_accounts_inner.rb +304 -0
  15. data/lib/pingram/models/phone_verify_confirm_response.rb +13 -4
  16. data/lib/pingram/version.rb +1 -1
  17. data/lib/pingram.rb +6 -0
  18. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/byebug-13.0.0/gem_make.out +5 -5
  19. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/date-3.5.1/gem_make.out +5 -5
  20. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.2/gem_make.out +5 -5
  21. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/io-console-0.9.2/mkmf.log +3 -3
  22. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/jaro_winkler-1.5.6/gem_make.out +5 -5
  23. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/psych-5.4.0/gem_make.out +5 -5
  24. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/racc-1.8.1/gem_make.out +5 -5
  25. data/vendor/bundle/ruby/3.2.0/extensions/x86_64-linux/3.2.0/stringio-3.2.0/gem_make.out +5 -5
  26. metadata +8 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cb108d4750254f5d0266c6996bf93ee20c96ba69a48f9c87b0b8cac105b7d34e
4
- data.tar.gz: 76b17f9e1d2457ef8d1fb21efedcb2be2024b80ee0c1e3de1079e72b115f444a
3
+ metadata.gz: c79d2c7d00bb7415ce85ef3c6ff7a9548fabf87d1586157a21f8585ee0deacd3
4
+ data.tar.gz: f45b6dc9e550903fdf53c8a9cb08249b4046416da6c3c9f18d55eb76ada341f1
5
5
  SHA512:
6
- metadata.gz: 68f9b19c250731d485cd4e0f91d7f50cb7be0c1d2d5c36ec93bdc359ae08f7f346c8060e6c49ae00bb9b980e59f09dd238e2abbab0bae530f36f3255d50bce5f
7
- data.tar.gz: 325135064572154dc797046c2b1f700a6763faf545b226c2932487ef67190fcf73edfaaee841975936921236eb4b761c21c114cebe86debeec8abeadd02a3a22
6
+ metadata.gz: afc6d61c2ea6dc821679aad06311e9cbfa7d351931853a696811dc6c4faaef70b8167ed832618cfc852565cbcbf4838ba0af844ec05b2380ee3263dc76f5ece0
7
+ data.tar.gz: a043e1a031ac0004779dcc6ea3caaf9d9a4a98b39fa1f775133c2e3a1ab97d0dec312757dec5f56b9d5480ded5da861b4ec86174c51f2bbc42371904d6b0efb4
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- pingram (1.0.22)
4
+ pingram (1.0.23)
5
5
  typhoeus (~> 1.0, >= 1.0.1)
6
6
 
7
7
  GEM
@@ -0,0 +1,143 @@
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 'cgi'
14
+
15
+ module Pingram
16
+ class AccountsApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Create an additional account for the authenticated user
23
+ # @param create_account_request [CreateAccountRequest]
24
+ # @param [Hash] opts the optional parameters
25
+ # @return [CreateAccountResponse]
26
+ def accounts_create_account(create_account_request, opts = {})
27
+ data, _status_code, _headers = accounts_create_account_with_http_info(create_account_request, opts)
28
+ data
29
+ end
30
+
31
+ # Create an additional account for the authenticated user
32
+ # @param create_account_request [CreateAccountRequest]
33
+ # @param [Hash] opts the optional parameters
34
+ # @return [Array<(CreateAccountResponse, Integer, Hash)>] CreateAccountResponse data, response status code and response headers
35
+ def accounts_create_account_with_http_info(create_account_request, opts = {})
36
+ if @api_client.config.debugging
37
+ @api_client.config.logger.debug 'Calling API: AccountsApi.accounts_create_account ...'
38
+ end
39
+ # verify the required parameter 'create_account_request' is set
40
+ if @api_client.config.client_side_validation && create_account_request.nil?
41
+ fail ArgumentError, "Missing the required parameter 'create_account_request' when calling AccountsApi.accounts_create_account"
42
+ end
43
+ # resource path
44
+ local_var_path = '/accounts'
45
+
46
+ # query parameters
47
+ query_params = opts[:query_params] || {}
48
+
49
+ # header parameters
50
+ header_params = opts[:header_params] || {}
51
+ # HTTP header 'Accept' (if needed)
52
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
53
+ # HTTP header 'Content-Type'
54
+ content_type = @api_client.select_header_content_type(['application/json'])
55
+ if !content_type.nil?
56
+ header_params['Content-Type'] = content_type
57
+ end
58
+
59
+ # form parameters
60
+ form_params = opts[:form_params] || {}
61
+
62
+ # http body (model)
63
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(create_account_request)
64
+
65
+ # return_type
66
+ return_type = opts[:debug_return_type] || 'CreateAccountResponse'
67
+
68
+ # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
69
+ auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']
70
+
71
+ new_options = opts.merge(
72
+ :operation => :"AccountsApi.accounts_create_account",
73
+ :header_params => header_params,
74
+ :query_params => query_params,
75
+ :form_params => form_params,
76
+ :body => post_body,
77
+ :auth_names => auth_names,
78
+ :return_type => return_type
79
+ )
80
+
81
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
82
+ if @api_client.config.debugging
83
+ @api_client.config.logger.debug "API called: AccountsApi#accounts_create_account\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
84
+ end
85
+ return data, status_code, headers
86
+ end
87
+
88
+ # List accounts the authenticated user can access
89
+ # @param [Hash] opts the optional parameters
90
+ # @return [ListAccountsResponse]
91
+ def accounts_list_accounts(opts = {})
92
+ data, _status_code, _headers = accounts_list_accounts_with_http_info(opts)
93
+ data
94
+ end
95
+
96
+ # List accounts the authenticated user can access
97
+ # @param [Hash] opts the optional parameters
98
+ # @return [Array<(ListAccountsResponse, Integer, Hash)>] ListAccountsResponse data, response status code and response headers
99
+ def accounts_list_accounts_with_http_info(opts = {})
100
+ if @api_client.config.debugging
101
+ @api_client.config.logger.debug 'Calling API: AccountsApi.accounts_list_accounts ...'
102
+ end
103
+ # resource path
104
+ local_var_path = '/accounts'
105
+
106
+ # query parameters
107
+ query_params = opts[:query_params] || {}
108
+
109
+ # header parameters
110
+ header_params = opts[:header_params] || {}
111
+ # HTTP header 'Accept' (if needed)
112
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
113
+
114
+ # form parameters
115
+ form_params = opts[:form_params] || {}
116
+
117
+ # http body (model)
118
+ post_body = opts[:debug_body]
119
+
120
+ # return_type
121
+ return_type = opts[:debug_return_type] || 'ListAccountsResponse'
122
+
123
+ # auth_names (apiKey last so Bearer wins when multiple schemes set Authorization)
124
+ auth_names = opts[:debug_auth_names] || ['endUserHashed', 'endUser', 'clientCredentials', 'apiKey']
125
+
126
+ new_options = opts.merge(
127
+ :operation => :"AccountsApi.accounts_list_accounts",
128
+ :header_params => header_params,
129
+ :query_params => query_params,
130
+ :form_params => form_params,
131
+ :body => post_body,
132
+ :auth_names => auth_names,
133
+ :return_type => return_type
134
+ )
135
+
136
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
137
+ if @api_client.config.debugging
138
+ @api_client.config.logger.debug "API called: AccountsApi#accounts_list_accounts\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
139
+ end
140
+ return data, status_code, headers
141
+ end
142
+ end
143
+ end
@@ -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.22"
35
+ @user_agent = "pingram-ruby/1.0.23"
36
36
  @default_headers = {
37
37
  'Content-Type' => 'application/json',
38
38
  'User-Agent' => @user_agent
@@ -10,6 +10,8 @@ require_relative 'webhooks'
10
10
 
11
11
  require_relative 'api/account_api'
12
12
 
13
+ require_relative 'api/accounts_api'
14
+
13
15
  require_relative 'api/addresses_api'
14
16
 
15
17
  require_relative 'api/components_api'
@@ -84,6 +86,8 @@ module Pingram
84
86
 
85
87
  @account = Pingram::AccountApi.new(@api_client)
86
88
 
89
+ @accounts = Pingram::AccountsApi.new(@api_client)
90
+
87
91
  @addresses = Pingram::AddressesApi.new(@api_client)
88
92
 
89
93
  @components = Pingram::ComponentsApi.new(@api_client)
@@ -137,6 +141,12 @@ module Pingram
137
141
  end
138
142
 
139
143
 
144
+ # @return [Pingram::AccountsApi]
145
+ def accounts
146
+ @accounts
147
+ end
148
+
149
+
140
150
  # @return [Pingram::AddressesApi]
141
151
  def addresses
142
152
  @addresses
@@ -44,6 +44,8 @@ module Pingram
44
44
 
45
45
  attr_accessor :updated_at
46
46
 
47
+ attr_accessor :status
48
+
47
49
  class EnumAttributeValidator
48
50
  attr_reader :datatype
49
51
  attr_reader :allowable_values
@@ -81,7 +83,8 @@ module Pingram
81
83
  :'anniversary_date' => :'anniversaryDate',
82
84
  :'allow_overage' => :'allowOverage',
83
85
  :'created_at' => :'createdAt',
84
- :'updated_at' => :'updatedAt'
86
+ :'updated_at' => :'updatedAt',
87
+ :'status' => :'status'
85
88
  }
86
89
  end
87
90
 
@@ -110,7 +113,8 @@ module Pingram
110
113
  :'anniversary_date' => :'String',
111
114
  :'allow_overage' => :'Boolean',
112
115
  :'created_at' => :'String',
113
- :'updated_at' => :'String'
116
+ :'updated_at' => :'String',
117
+ :'status' => :'String'
114
118
  }
115
119
  end
116
120
 
@@ -203,6 +207,10 @@ module Pingram
203
207
  else
204
208
  self.updated_at = nil
205
209
  end
210
+
211
+ if attributes.key?(:'status')
212
+ self.status = attributes[:'status']
213
+ end
206
214
  end
207
215
 
208
216
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -261,6 +269,8 @@ module Pingram
261
269
  return false if @allow_overage.nil?
262
270
  return false if @created_at.nil?
263
271
  return false if @updated_at.nil?
272
+ status_validator = EnumAttributeValidator.new('String', ["verified", "unverified", "blocked"])
273
+ return false unless status_validator.valid?(@status)
264
274
  true
265
275
  end
266
276
 
@@ -354,6 +364,16 @@ module Pingram
354
364
  @updated_at = updated_at
355
365
  end
356
366
 
367
+ # Custom attribute writer method checking allowed values (enum).
368
+ # @param [Object] status Object to be assigned
369
+ def status=(status)
370
+ validator = EnumAttributeValidator.new('String', ["verified", "unverified", "blocked"])
371
+ unless validator.valid?(status)
372
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
373
+ end
374
+ @status = status
375
+ end
376
+
357
377
  # Checks equality by comparing each attribute.
358
378
  # @param [Object] Object to be compared
359
379
  def ==(o)
@@ -371,7 +391,8 @@ module Pingram
371
391
  anniversary_date == o.anniversary_date &&
372
392
  allow_overage == o.allow_overage &&
373
393
  created_at == o.created_at &&
374
- updated_at == o.updated_at
394
+ updated_at == o.updated_at &&
395
+ status == o.status
375
396
  end
376
397
 
377
398
  # @see the `==` method
@@ -383,7 +404,7 @@ module Pingram
383
404
  # Calculates hash code according to all attributes.
384
405
  # @return [Integer] Hash code
385
406
  def hash
386
- [account_id, account_type, creator, name, messages_cap, cost_cap, sms_cap, call_cap, billing_version, anniversary_date, allow_overage, created_at, updated_at].hash
407
+ [account_id, account_type, creator, name, messages_cap, cost_cap, sms_cap, call_cap, billing_version, anniversary_date, allow_overage, created_at, updated_at, status].hash
387
408
  end
388
409
 
389
410
  # Builds the object from hash
@@ -44,6 +44,8 @@ module Pingram
44
44
 
45
45
  attr_accessor :updated_at
46
46
 
47
+ attr_accessor :status
48
+
47
49
  attr_accessor :session_id
48
50
 
49
51
  attr_accessor :url
@@ -86,6 +88,7 @@ module Pingram
86
88
  :'allow_overage' => :'allowOverage',
87
89
  :'created_at' => :'createdAt',
88
90
  :'updated_at' => :'updatedAt',
91
+ :'status' => :'status',
89
92
  :'session_id' => :'sessionId',
90
93
  :'url' => :'url'
91
94
  }
@@ -117,6 +120,7 @@ module Pingram
117
120
  :'allow_overage' => :'Boolean',
118
121
  :'created_at' => :'String',
119
122
  :'updated_at' => :'String',
123
+ :'status' => :'String',
120
124
  :'session_id' => :'String',
121
125
  :'url' => :'String'
122
126
  }
@@ -212,6 +216,10 @@ module Pingram
212
216
  self.updated_at = nil
213
217
  end
214
218
 
219
+ if attributes.key?(:'status')
220
+ self.status = attributes[:'status']
221
+ end
222
+
215
223
  if attributes.key?(:'session_id')
216
224
  self.session_id = attributes[:'session_id']
217
225
  end
@@ -277,6 +285,8 @@ module Pingram
277
285
  return false if @allow_overage.nil?
278
286
  return false if @created_at.nil?
279
287
  return false if @updated_at.nil?
288
+ status_validator = EnumAttributeValidator.new('String', ["verified", "unverified", "blocked"])
289
+ return false unless status_validator.valid?(@status)
280
290
  true
281
291
  end
282
292
 
@@ -370,6 +380,16 @@ module Pingram
370
380
  @updated_at = updated_at
371
381
  end
372
382
 
383
+ # Custom attribute writer method checking allowed values (enum).
384
+ # @param [Object] status Object to be assigned
385
+ def status=(status)
386
+ validator = EnumAttributeValidator.new('String', ["verified", "unverified", "blocked"])
387
+ unless validator.valid?(status)
388
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
389
+ end
390
+ @status = status
391
+ end
392
+
373
393
  # Checks equality by comparing each attribute.
374
394
  # @param [Object] Object to be compared
375
395
  def ==(o)
@@ -388,6 +408,7 @@ module Pingram
388
408
  allow_overage == o.allow_overage &&
389
409
  created_at == o.created_at &&
390
410
  updated_at == o.updated_at &&
411
+ status == o.status &&
391
412
  session_id == o.session_id &&
392
413
  url == o.url
393
414
  end
@@ -401,7 +422,7 @@ module Pingram
401
422
  # Calculates hash code according to all attributes.
402
423
  # @return [Integer] Hash code
403
424
  def hash
404
- [account_id, account_type, creator, name, messages_cap, cost_cap, sms_cap, call_cap, billing_version, anniversary_date, allow_overage, created_at, updated_at, session_id, url].hash
425
+ [account_id, account_type, creator, name, messages_cap, cost_cap, sms_cap, call_cap, billing_version, anniversary_date, allow_overage, created_at, updated_at, status, session_id, url].hash
405
426
  end
406
427
 
407
428
  # Builds the object from hash
@@ -14,14 +14,21 @@ require 'date'
14
14
  require 'time'
15
15
 
16
16
  module Pingram
17
+ # Request body for POST /accounts (create additional account).
17
18
  class CreateAccountRequest < ApiModelBase
18
- # First-touch PostHog props from the client; attached to signup events.
19
- attr_accessor :attribution
19
+ attr_accessor :name
20
+
21
+ attr_accessor :plan
22
+
23
+ # Emails to add or invite to the new account. Existing members of any account the caller belongs to are added directly; everyone else is invited.
24
+ attr_accessor :member_emails
20
25
 
21
26
  # Attribute mapping from ruby-style variable name to JSON key.
22
27
  def self.attribute_map
23
28
  {
24
- :'attribution' => :'attribution'
29
+ :'name' => :'name',
30
+ :'plan' => :'plan',
31
+ :'member_emails' => :'memberEmails'
25
32
  }
26
33
  end
27
34
 
@@ -38,7 +45,9 @@ module Pingram
38
45
  # Attribute type mapping.
39
46
  def self.openapi_types
40
47
  {
41
- :'attribution' => :'Hash<String, String>'
48
+ :'name' => :'String',
49
+ :'plan' => :'CreateAccountRequestPlan',
50
+ :'member_emails' => :'Array<String>'
42
51
  }
43
52
  end
44
53
 
@@ -64,9 +73,19 @@ module Pingram
64
73
  h[k.to_sym] = v
65
74
  }
66
75
 
67
- if attributes.key?(:'attribution')
68
- if (value = attributes[:'attribution']).is_a?(Hash)
69
- self.attribution = value
76
+ if attributes.key?(:'name')
77
+ self.name = attributes[:'name']
78
+ else
79
+ self.name = nil
80
+ end
81
+
82
+ if attributes.key?(:'plan')
83
+ self.plan = attributes[:'plan']
84
+ end
85
+
86
+ if attributes.key?(:'member_emails')
87
+ if (value = attributes[:'member_emails']).is_a?(Array)
88
+ self.member_emails = value
70
89
  end
71
90
  end
72
91
  end
@@ -76,6 +95,10 @@ module Pingram
76
95
  def list_invalid_properties
77
96
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
78
97
  invalid_properties = Array.new
98
+ if @name.nil?
99
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
100
+ end
101
+
79
102
  invalid_properties
80
103
  end
81
104
 
@@ -83,15 +106,28 @@ module Pingram
83
106
  # @return true if the model is valid
84
107
  def valid?
85
108
  warn '[DEPRECATED] the `valid?` method is obsolete'
109
+ return false if @name.nil?
86
110
  true
87
111
  end
88
112
 
113
+ # Custom attribute writer method with validation
114
+ # @param [Object] name Value to be assigned
115
+ def name=(name)
116
+ if name.nil?
117
+ fail ArgumentError, 'name cannot be nil'
118
+ end
119
+
120
+ @name = name
121
+ end
122
+
89
123
  # Checks equality by comparing each attribute.
90
124
  # @param [Object] Object to be compared
91
125
  def ==(o)
92
126
  return true if self.equal?(o)
93
127
  self.class == o.class &&
94
- attribution == o.attribution
128
+ name == o.name &&
129
+ plan == o.plan &&
130
+ member_emails == o.member_emails
95
131
  end
96
132
 
97
133
  # @see the `==` method
@@ -103,7 +139,7 @@ module Pingram
103
139
  # Calculates hash code according to all attributes.
104
140
  # @return [Integer] Hash code
105
141
  def hash
106
- [attribution].hash
142
+ [name, plan, member_emails].hash
107
143
  end
108
144
 
109
145
  # Builds the object from hash
@@ -0,0 +1,216 @@
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
+ # Billing to copy onto a new additional account.
18
+ class CreateAccountRequestPlan < ApiModelBase
19
+ attr_accessor :tier
20
+
21
+ # Account whose saved payment method is copied onto the new account. The caller must be an owner of this account.
22
+ attr_accessor :source_billing_account_id
23
+
24
+ class EnumAttributeValidator
25
+ attr_reader :datatype
26
+ attr_reader :allowable_values
27
+
28
+ def initialize(datatype, allowable_values)
29
+ @allowable_values = allowable_values.map do |value|
30
+ case datatype.to_s
31
+ when /Integer/i
32
+ value.to_i
33
+ when /Float/i
34
+ value.to_f
35
+ else
36
+ value
37
+ end
38
+ end
39
+ end
40
+
41
+ def valid?(value)
42
+ !value || allowable_values.include?(value)
43
+ end
44
+ end
45
+
46
+ # Attribute mapping from ruby-style variable name to JSON key.
47
+ def self.attribute_map
48
+ {
49
+ :'tier' => :'tier',
50
+ :'source_billing_account_id' => :'sourceBillingAccountId'
51
+ }
52
+ end
53
+
54
+ # Returns attribute mapping this model knows about
55
+ def self.acceptable_attribute_map
56
+ attribute_map
57
+ end
58
+
59
+ # Returns all the JSON keys this model knows about
60
+ def self.acceptable_attributes
61
+ acceptable_attribute_map.values
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.openapi_types
66
+ {
67
+ :'tier' => :'String',
68
+ :'source_billing_account_id' => :'String'
69
+ }
70
+ end
71
+
72
+ # List of attributes with nullable: true
73
+ def self.openapi_nullable
74
+ Set.new([
75
+ ])
76
+ end
77
+
78
+ # Initializes the object
79
+ # @param [Hash] attributes Model attributes in the form of hash
80
+ def initialize(attributes = {})
81
+ if (!attributes.is_a?(Hash))
82
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Pingram::CreateAccountRequestPlan` initialize method"
83
+ end
84
+
85
+ # check to see if the attribute exists and convert string to symbol for hash key
86
+ acceptable_attribute_map = self.class.acceptable_attribute_map
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!acceptable_attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Pingram::CreateAccountRequestPlan`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'tier')
95
+ self.tier = attributes[:'tier']
96
+ else
97
+ self.tier = nil
98
+ end
99
+
100
+ if attributes.key?(:'source_billing_account_id')
101
+ self.source_billing_account_id = attributes[:'source_billing_account_id']
102
+ else
103
+ self.source_billing_account_id = nil
104
+ end
105
+ end
106
+
107
+ # Show invalid properties with the reasons. Usually used together with valid?
108
+ # @return Array for valid properties with the reasons
109
+ def list_invalid_properties
110
+ warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
111
+ invalid_properties = Array.new
112
+ if @tier.nil?
113
+ invalid_properties.push('invalid value for "tier", tier cannot be nil.')
114
+ end
115
+
116
+ if @source_billing_account_id.nil?
117
+ invalid_properties.push('invalid value for "source_billing_account_id", source_billing_account_id cannot be nil.')
118
+ end
119
+
120
+ invalid_properties
121
+ end
122
+
123
+ # Check to see if the all the properties in the model are valid
124
+ # @return true if the model is valid
125
+ def valid?
126
+ warn '[DEPRECATED] the `valid?` method is obsolete'
127
+ return false if @tier.nil?
128
+ tier_validator = EnumAttributeValidator.new('String', ["budget_20", "budget_50", "budget_100", "budget_250", "budget_500", "budget_1000", "budget_2000", "budget_5000"])
129
+ return false unless tier_validator.valid?(@tier)
130
+ return false if @source_billing_account_id.nil?
131
+ true
132
+ end
133
+
134
+ # Custom attribute writer method checking allowed values (enum).
135
+ # @param [Object] tier Object to be assigned
136
+ def tier=(tier)
137
+ validator = EnumAttributeValidator.new('String', ["budget_20", "budget_50", "budget_100", "budget_250", "budget_500", "budget_1000", "budget_2000", "budget_5000"])
138
+ unless validator.valid?(tier)
139
+ fail ArgumentError, "invalid value for \"tier\", must be one of #{validator.allowable_values}."
140
+ end
141
+ @tier = tier
142
+ end
143
+
144
+ # Custom attribute writer method with validation
145
+ # @param [Object] source_billing_account_id Value to be assigned
146
+ def source_billing_account_id=(source_billing_account_id)
147
+ if source_billing_account_id.nil?
148
+ fail ArgumentError, 'source_billing_account_id cannot be nil'
149
+ end
150
+
151
+ @source_billing_account_id = source_billing_account_id
152
+ end
153
+
154
+ # Checks equality by comparing each attribute.
155
+ # @param [Object] Object to be compared
156
+ def ==(o)
157
+ return true if self.equal?(o)
158
+ self.class == o.class &&
159
+ tier == o.tier &&
160
+ source_billing_account_id == o.source_billing_account_id
161
+ end
162
+
163
+ # @see the `==` method
164
+ # @param [Object] Object to be compared
165
+ def eql?(o)
166
+ self == o
167
+ end
168
+
169
+ # Calculates hash code according to all attributes.
170
+ # @return [Integer] Hash code
171
+ def hash
172
+ [tier, source_billing_account_id].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ return nil unless attributes.is_a?(Hash)
180
+ attributes = attributes.transform_keys(&:to_sym)
181
+ transformed_hash = {}
182
+ openapi_types.each_pair do |key, type|
183
+ if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
184
+ transformed_hash["#{key}"] = nil
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[attribute_map[key]].is_a?(Array)
189
+ transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
190
+ end
191
+ elsif !attributes[attribute_map[key]].nil?
192
+ transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
193
+ end
194
+ end
195
+ new(transformed_hash)
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ if value.nil?
205
+ is_nullable = self.class.openapi_nullable.include?(attr)
206
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
207
+ end
208
+
209
+ hash[param] = _to_hash(value)
210
+ end
211
+ hash
212
+ end
213
+
214
+ end
215
+
216
+ end