Class: UltracartClient::ConversationPbxPayConnector

Inherits:
Object
  • Object
show all
Defined in:
lib/ultracart_api/models/conversation_pbx_pay_connector.rb

Defined Under Namespace

Classes: EnumAttributeValidator

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ConversationPbxPayConnector

Initializes the object

Parameters:

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

    Model attributes in the form of hash



105
106
107
108
109
110
111
112
113
114
115
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
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 105

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

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#description ⇒ Object

Description of the connector



19
20
21
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 19

def description
  @description
end

#environment ⇒ Object

Environment the connector points at. Only live connectors are returned. Sandbox and unconfigured connectors are ignored.



22
23
24
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 22

def environment
  @environment
end

#friendly_name ⇒ Object

Friendly name of the connector as shown in the Twilio console



25
26
27
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 25

def friendly_name
  @friendly_name
end

#merchant_id ⇒ Object

Merchant Id



28
29
30
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 28

def merchant_id
  @merchant_id
end

#processor ⇒ Object

Payment processor behind this connector



31
32
33
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 31

def processor
  @processor
end

#processor_account_id ⇒ Object

The processor account this connector is bound to (Stripe connected account id or Braintree merchant id). A payment captured with this connector can only be charged within this account.



34
35
36
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 34

def 
  
end

#sid ⇒ Object

Twilio installed add-on SID for this connector



37
38
39
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 37

def sid
  @sid
end

#unique_name ⇒ Object

Unique name of the connector. This is the value used for the paymentConnector attribute of the Twilio Pay verb.



40
41
42
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 40

def unique_name
  @unique_name
end

Class Method Details

.acceptable_attributes ⇒ Object

Returns all the JSON keys this model knows about



79
80
81
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 79

def self.acceptable_attributes
  attribute_map.values
end

.attribute_map ⇒ Object

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



65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 65

def self.attribute_map
  {
    :'description' => :'description',
    :'environment' => :'environment',
    :'friendly_name' => :'friendly_name',
    :'merchant_id' => :'merchant_id',
    :'processor' => :'processor',
    :'processor_account_id' => :'processor_account_id',
    :'sid' => :'sid',
    :'unique_name' => :'unique_name'
  }
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



308
309
310
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 308

def self.build_from_hash(attributes)
  new.build_from_hash(attributes)
end

.openapi_nullable ⇒ Object

List of attributes with nullable: true



98
99
100
101
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 98

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

.openapi_types ⇒ Object

Attribute type mapping.



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 84

def self.openapi_types
  {
    :'description' => :'String',
    :'environment' => :'String',
    :'friendly_name' => :'String',
    :'merchant_id' => :'String',
    :'processor' => :'String',
    :'processor_account_id' => :'String',
    :'sid' => :'String',
    :'unique_name' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object) —

    to be compared



280
281
282
283
284
285
286
287
288
289
290
291
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 280

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      description == o.description &&
      environment == o.environment &&
      friendly_name == o.friendly_name &&
      merchant_id == o.merchant_id &&
      processor == o.processor &&
       == o. &&
      sid == o.sid &&
      unique_name == o.unique_name
end

#_deserialize(type, value) ⇒ Object

Deserializes the data based on type

Parameters:

  • string —

    type Data type

  • string —

    value Value to be deserialized

Returns:

  • (Object) —

    Deserialized data



339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 339

def _deserialize(type, value)
  case type.to_sym
  when :Time
    Time.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :Boolean
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    # models (e.g. Pet) or oneOf
    klass = UltracartClient.const_get(type)
    klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
  end
end

#_to_hash(value) ⇒ Hash

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value

Parameters:

  • value (Object) —

    Any valid value

Returns:

  • (Hash) —

    Returns the value in the form of hash



410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 410

def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map { |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
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



315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 315

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  attributes = attributes.transform_keys(&:to_sym)
  self.class.openapi_types.each_pair do |key, type|
    if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
      self.send("#{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[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object) —

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


295
296
297
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 295

def eql?(o)
  self == o
end

#hash ⇒ Integer

Calculates hash code according to all attributes.

Returns:

  • (Integer) —

    Hash code



301
302
303
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 301

def hash
  [description, environment, friendly_name, merchant_id, processor, , sid, unique_name].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



153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 153

def list_invalid_properties
  invalid_properties = Array.new
  if !@description.nil? && @description.to_s.length > 250
    invalid_properties.push('invalid value for "description", the character length must be smaller than or equal to 250.')
  end

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

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

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

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

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

  invalid_properties
end

#to_body ⇒ Hash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash) —

    Returns the object in the form of hash



386
387
388
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 386

def to_body
  to_hash
end

#to_hash ⇒ Hash

Returns the object in the form of hash

Returns:

  • (Hash) —

    Returns the object in the form of hash



392
393
394
395
396
397
398
399
400
401
402
403
404
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 392

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

#to_s ⇒ String

Returns the string representation of the object

Returns:

  • (String) —

    String presentation of the object



380
381
382
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 380

def to_s
  to_hash.to_s
end

#valid? ⇒ Boolean

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

Returns:

  • (Boolean) —

    true if the model is valid



184
185
186
187
188
189
190
191
192
193
194
195
196
# File 'lib/ultracart_api/models/conversation_pbx_pay_connector.rb', line 184

def valid?
  return false if !@description.nil? && @description.to_s.length > 250
  environment_validator = EnumAttributeValidator.new('String', ["live"])
  return false unless environment_validator.valid?(@environment)
  return false if !@friendly_name.nil? && @friendly_name.to_s.length > 100
  return false if !@merchant_id.nil? && @merchant_id.to_s.length > 5
  processor_validator = EnumAttributeValidator.new('String', ["stripe", "braintree", "generic", "unknown"])
  return false unless processor_validator.valid?(@processor)
  return false if !.nil? && .to_s.length > 100
  return false if !@sid.nil? && @sid.to_s.length > 50
  return false if !@unique_name.nil? && @unique_name.to_s.length > 100
  true
end