Class: CyberSource::GeneratePublicKeyRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/cybersource_rest_client/models/generate_public_key_request.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GeneratePublicKeyRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 66

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  if attributes.has_key?(:'encryptionType')
    self.encryption_type = attributes[:'encryptionType']
  end

  if attributes.has_key?(:'targetOrigin')
    self.target_origin = attributes[:'targetOrigin']
  end

  if attributes.has_key?(:'unmaskedLeft')
    self.unmasked_left = attributes[:'unmaskedLeft']
  end

  if attributes.has_key?(:'unmaskedRight')
    self.unmasked_right = attributes[:'unmaskedRight']
  end

  if attributes.has_key?(:'enableBillingAddress')
    self.enable_billing_address = attributes[:'enableBillingAddress']
  end

  if attributes.has_key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.has_key?(:'enableAutoAuth')
    self.enable_auto_auth = attributes[:'enableAutoAuth']
  end
end

Instance Attribute Details

#currencyObject

Three character ISO currency code to be associated with the token. Required for legacy integrations. Default value: USD.



33
34
35
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 33

def currency
  @currency
end

#enable_auto_authObject

Specifies whether or not an account verification authorization ($0 Authorization) is carried out on token creation. Default is false, as it is assumed a full or zero amount authorization will be carried out in a separate call from your server.



36
37
38
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 36

def enable_auto_auth
  @enable_auto_auth
end

#enable_billing_addressObject

Specifies whether or not ‘dummy’ address data should be specified in the create token request. If you have ‘Relaxed AVS’ enabled for your MID, this value can be set to False.Default value: true



30
31
32
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 30

def enable_billing_address
  @enable_billing_address
end

#encryption_typeObject

How the card number should be encrypted in the subsequent Tokenize Card request. Possible values are RsaOaep256 or None (if using this value the card number must be in plain text when included in the Tokenize Card request). The Tokenize Card request uses a secure connection (TLS 1.2+) regardless of what encryption type is specified.



18
19
20
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 18

def encryption_type
  @encryption_type
end

#target_originObject

This should only be used if using the Microform implementation. This is the protocol, URL, and if used, port number of the page that will host the Microform. Unless using localhost, the protocol must be https://. For example, if serving Microform on example.com, the targetOrigin is example.com The value is used to restrict the frame ancestor of the Microform. If there is a mismatch between this value and the frame ancestor, the Microfrom will not load.



21
22
23
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 21

def target_origin
  @target_origin
end

#unmasked_leftObject

Specifies the number of card number digits to be returned un-masked from the left. For example, setting this value to 6 will return: 411111XXXXXXXXXX Default value: 6 Maximum value: 6



24
25
26
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 24

def unmasked_left
  @unmasked_left
end

#unmasked_rightObject

Specifies the number of card number digits to be returned un-masked from the right. For example, setting this value to 4 will return: 411111XXXXXX1111 Default value: 4 Maximum value: 4



27
28
29
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 27

def unmasked_right
  @unmasked_right
end

Class Method Details

.attribute_mapObject

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



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 39

def self.attribute_map
  {
    :'encryption_type' => :'encryptionType',
    :'target_origin' => :'targetOrigin',
    :'unmasked_left' => :'unmaskedLeft',
    :'unmasked_right' => :'unmaskedRight',
    :'enable_billing_address' => :'enableBillingAddress',
    :'currency' => :'currency',
    :'enable_auto_auth' => :'enableAutoAuth'
  }
end

.swagger_typesObject

Attribute type mapping.



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 52

def self.swagger_types
  {
    :'encryption_type' => :'String',
    :'target_origin' => :'String',
    :'unmasked_left' => :'Integer',
    :'unmasked_right' => :'Integer',
    :'enable_billing_address' => :'BOOLEAN',
    :'currency' => :'String',
    :'enable_auto_auth' => :'BOOLEAN'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 121

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      encryption_type == o.encryption_type &&
      target_origin == o.target_origin &&
      unmasked_left == o.unmasked_left &&
      unmasked_right == o.unmasked_right &&
      enable_billing_address == o.enable_billing_address &&
      currency == o.currency &&
      enable_auto_auth == o.enable_auto_auth
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



169
170
171
172
173
174
175
176
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
203
204
205
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 169

def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.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
    temp_model = CyberSource.const_get(type).new
    temp_model.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



235
236
237
238
239
240
241
242
243
244
245
246
247
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 235

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



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 148

def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the 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 # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


135
136
137
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 135

def eql?(o)
  self == o
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



141
142
143
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 141

def hash
  [encryption_type, target_origin, unmasked_left, unmasked_right, enable_billing_address, currency, enable_auto_auth].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



103
104
105
106
107
108
109
110
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 103

def list_invalid_properties
  invalid_properties = Array.new
  if @encryption_type.nil?
    invalid_properties.push('invalid value for "encryption_type", encryption_type cannot be nil.')
  end

  invalid_properties
end

#to_bodyHash

to_body is an alias to to_hash (backward compatibility)

Returns:

  • (Hash)

    Returns the object in the form of hash



215
216
217
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 215

def to_body
  to_hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



221
222
223
224
225
226
227
228
229
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 221

def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end

#to_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



209
210
211
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 209

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



114
115
116
117
# File 'lib/cybersource_rest_client/models/generate_public_key_request.rb', line 114

def valid?
  return false if @encryption_type.nil?
  true
end