Class: Zernio::OrderImessageSenderRequest

Inherits:
ApiModelBase show all
Defined in:
lib/zernio-sdk/models/order_imessage_sender_request.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ OrderImessageSenderRequest

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {}) —

    Model attributes in the form of hash



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 116

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Zernio::OrderImessageSenderRequest` initialize method"
  end

  # check to see if the attribute exists and convert string to symbol for hash key
  acceptable_attribute_map = self.class.acceptable_attribute_map
  attributes = attributes.each_with_object({}) { |(k, v), h|
    if (!acceptable_attribute_map.key?(k.to_sym))
      fail ArgumentError, "`#{k}` is not a valid attribute in `Zernio::OrderImessageSenderRequest`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect
    end
    h[k.to_sym] = v
  }

  if attributes.key?(:'profile_id')
    self.profile_id = attributes[:'profile_id']
  else
    self.profile_id = nil
  end

  if attributes.key?(:'kind')
    self.kind = attributes[:'kind']
  else
    self.kind = nil
  end

  if attributes.key?(:'region')
    self.region = attributes[:'region']
  end

  if attributes.key?(:'available_number_id')
    self.available_number_id = attributes[:'available_number_id']
  end

  if attributes.key?(:'zip_code')
    self.zip_code = attributes[:'zip_code']
  end

  if attributes.key?(:'email_name')
    self.email_name = attributes[:'email_name']
  end

  if attributes.key?(:'email_domain')
    self.email_domain = attributes[:'email_domain']
  end

  if attributes.key?(:'display_name')
    self.display_name = attributes[:'display_name']
  end

  if attributes.key?(:'purchase_intent_id')
    self.purchase_intent_id = attributes[:'purchase_intent_id']
  end

  if attributes.key?(:'contact')
    self.contact = attributes[:'contact']
  end
end

Instance Attribute Details

#available_number_id ⇒ Object

A number from GET /v1/imessage/senders/available-numbers. It is assigned and activated on order instead of waiting for provisioning. Phone senders only.



26
27
28
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 26

def available_number_id
  @available_number_id
end

#contact ⇒ Object

Returns the value of attribute contact.



42
43
44
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 42

def contact
  @contact
end

#display_name ⇒ Object

Returns the value of attribute display_name.



37
38
39
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 37

def display_name
  @display_name
end

#email_domain ⇒ Object

Domain for email senders (required for kind: email)



35
36
37
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 35

def email_domain
  @email_domain
end

#email_name ⇒ Object

Local part for email senders (required for kind: email)



32
33
34
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 32

def email_name
  @email_name
end

#kind ⇒ Object

Returns the value of attribute kind.



20
21
22
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 20

def kind
  @kind
end

#profile_id ⇒ Object

Returns the value of attribute profile_id.



18
19
20
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 18

def profile_id
  @profile_id
end

#purchase_intent_id ⇒ Object

Idempotency key for safe retries



40
41
42
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 40

def purchase_intent_id
  @purchase_intent_id
end

#region ⇒ Object

Required for phone senders. Without availableNumberId the number is carrier-assigned in this region and revealed once the sender activates.



23
24
25
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 23

def region
  @region
end

#zip_code ⇒ Object

US phone senders only. Preferred area for a carrier-assigned number (ignored with availableNumberId).



29
30
31
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 29

def zip_code
  @zip_code
end

Class Method Details

.acceptable_attribute_map ⇒ Object

Returns attribute mapping this model knows about



83
84
85
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 83

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



88
89
90
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 88

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_map ⇒ Object

Attribute mapping from ruby-style variable name to JSON key.



67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 67

def self.attribute_map
  {
    :'profile_id' => :'profileId',
    :'kind' => :'kind',
    :'region' => :'region',
    :'available_number_id' => :'availableNumberId',
    :'zip_code' => :'zipCode',
    :'email_name' => :'emailName',
    :'email_domain' => :'emailDomain',
    :'display_name' => :'displayName',
    :'purchase_intent_id' => :'purchaseIntentId',
    :'contact' => :'contact'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash) —

    Model attributes in the form of hash

Returns:

  • (Object) —

    Returns the model itself



325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 325

def self.build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  transformed_hash = {}
  openapi_types.each_pair do |key, type|
    if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = nil
    elsif type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the attribute
      # is documented as an array but the input is not
      if attributes[attribute_map[key]].is_a?(Array)
        transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) }
      end
    elsif !attributes[attribute_map[key]].nil?
      transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]])
    end
  end
  new(transformed_hash)
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



109
110
111
112
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 109

def self.openapi_nullable
  Set.new([
  ])
end

.openapi_types ⇒ Object

Attribute type mapping.



93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 93

def self.openapi_types
  {
    :'profile_id' => :'String',
    :'kind' => :'String',
    :'region' => :'String',
    :'available_number_id' => :'String',
    :'zip_code' => :'String',
    :'email_name' => :'String',
    :'email_domain' => :'String',
    :'display_name' => :'String',
    :'purchase_intent_id' => :'String',
    :'contact' => :'OrderImessageSenderRequestContact'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 295

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      profile_id == o.profile_id &&
      kind == o.kind &&
      region == o.region &&
      available_number_id == o.available_number_id &&
      zip_code == o.zip_code &&
      email_name == o.email_name &&
      email_domain == o.email_domain &&
      display_name == o.display_name &&
      purchase_intent_id == o.purchase_intent_id &&
      contact == o.contact
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


312
313
314
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 312

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



318
319
320
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 318

def hash
  [profile_id, kind, region, available_number_id, zip_code, email_name, email_domain, display_name, purchase_intent_id, contact].hash
end

#list_invalid_properties ⇒ Object

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 177

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  if @profile_id.nil?
    invalid_properties.push('invalid value for "profile_id", profile_id cannot be nil.')
  end

  if @kind.nil?
    invalid_properties.push('invalid value for "kind", kind cannot be nil.')
  end

  pattern = Regexp.new(/^[0-9]{5}$/)
  if !@zip_code.nil? && @zip_code !~ pattern
    invalid_properties.push("invalid value for \"zip_code\", must conform to the pattern #{pattern}.")
  end

  if !@display_name.nil? && @display_name.to_s.length > 100
    invalid_properties.push('invalid value for "display_name", the character length must be smaller than or equal to 100.')
  end

  if !@purchase_intent_id.nil? && @purchase_intent_id.to_s.length > 100
    invalid_properties.push('invalid value for "purchase_intent_id", the character length must be smaller than or equal to 100.')
  end

  invalid_properties
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



347
348
349
350
351
352
353
354
355
356
357
358
359
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 347

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    if value.nil?
      is_nullable = self.class.openapi_nullable.include?(attr)
      next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
    end

    hash[param] = _to_hash(value)
  end
  hash
end

#valid? ⇒ Boolean

Check to see if the all the properties in the model are valid

Returns:

  • (Boolean) —

    true if the model is valid



206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/zernio-sdk/models/order_imessage_sender_request.rb', line 206

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  return false if @profile_id.nil?
  return false if @kind.nil?
  kind_validator = EnumAttributeValidator.new('String', ["phone", "email"])
  return false unless kind_validator.valid?(@kind)
  region_validator = EnumAttributeValidator.new('String', ["US", "GB"])
  return false unless region_validator.valid?(@region)
  return false if !@zip_code.nil? && @zip_code !~ Regexp.new(/^[0-9]{5}$/)
  return false if !@display_name.nil? && @display_name.to_s.length > 100
  return false if !@purchase_intent_id.nil? && @purchase_intent_id.to_s.length > 100
  true
end