Class: Bfwd::PaymentMethod
- Inherits:
-
Object
- Object
- Bfwd::PaymentMethod
- Defined in:
- lib/bf_ruby2/models/payment_method.rb
Overview
PaymentMethod
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#account_id ⇒ Object
{ "description" : "ID of the account associated with the payment-method.", "verbs“: }.
-
#card_holder_name ⇒ Object
{ "description" : "Name of the card holder", "verbs“: }.
-
#card_type ⇒ Object
{ "description" : "Type of the card. In the case of card payment methods this is the payment type, for example VISA, MasterCard.", "verbs“: }.
-
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }.
-
#country ⇒ Object
Returns the value of attribute country.
-
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }.
-
#crm_id ⇒ Object
{ "description" : "CRM ID of the product-rate-plan.", "verbs":] }.
-
#default_payment_method ⇒ Object
{"default" : "false", "description" : "Indicates if this is the default payment method for the account.", "verbs“: }.
-
#deleted ⇒ Object
{"default" : "false", "description" : "Indicates if a payment-method has been retired. If a payment-method has been retired it can still be retrieved using the appropriate flag on API requests. Generally payment-methods will be retired by customers wanting to remove the payment method from their account. Caution should be used when requested deleted payment methods.", "verbs“: }.
-
#description ⇒ Object
{ "description" : "Description of the payment-method.", "verbs“: }.
-
#expiry_date ⇒ Object
{ "description" : "In the case of card payment methods this is the expiry date of the card, format should be MMYY including leading 0’s. For example 0115 for January 2015.", "verbs“: }.
-
#expiry_month ⇒ Object
Returns the value of attribute expiry_month.
-
#expiry_year ⇒ Object
Returns the value of attribute expiry_year.
-
#first_six ⇒ Object
Returns the value of attribute first_six.
-
#gateway ⇒ Object
{ "description" : "Gateway type for payment-method.", "verbs“: }.
-
#id ⇒ Object
{ "description" : "ID of the payment-method.", "verbs“: }.
-
#ip_address ⇒ Object
address associated with this payment method.“,”verbs“:.
-
#ip_address_country ⇒ Object
of the IP address associated with this payment method.“,”verbs“:.
-
#last_four ⇒ Object
Returns the value of attribute last_four.
-
#link_id ⇒ Object
Returns the value of attribute link_id.
-
#name ⇒ Object
{ "description" : "Name of the payment-method.", "verbs“: }.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#province ⇒ Object
Returns the value of attribute province.
-
#state ⇒ Object
{ "description" : "State of the payment-method.", "verbs“: }.
-
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
-
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type.
-
#_to_hash(value) ⇒ Hash
Outputs non-array value in the form of hash For object, use to_hash.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ PaymentMethod
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility).
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Constructor Details
#initialize(attributes = {}) ⇒ PaymentMethod
Initializes the object
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 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 171 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?(:'created') self.created = attributes[:'created'] end if attributes.has_key?(:'changedBy') self.changed_by = attributes[:'changedBy'] end if attributes.has_key?(:'updated') self.updated = attributes[:'updated'] end if attributes.has_key?(:'id') self.id = attributes[:'id'] end if attributes.has_key?(:'crmID') self.crm_id = attributes[:'crmID'] end if attributes.has_key?(:'accountID') self.account_id = attributes[:'accountID'] end if attributes.has_key?(:'organizationID') self.organization_id = attributes[:'organizationID'] end if attributes.has_key?(:'name') self.name = attributes[:'name'] end if attributes.has_key?(:'description') self.description = attributes[:'description'] end if attributes.has_key?(:'cardHolderName') self.card_holder_name = attributes[:'cardHolderName'] end if attributes.has_key?(:'expiryDate') self.expiry_date = attributes[:'expiryDate'] end if attributes.has_key?(:'cardType') self.card_type = attributes[:'cardType'] end if attributes.has_key?(:'country') self.country = attributes[:'country'] end if attributes.has_key?(:'province') self.province = attributes[:'province'] end if attributes.has_key?(:'firstSix') self.first_six = attributes[:'firstSix'] end if attributes.has_key?(:'lastFour') self.last_four = attributes[:'lastFour'] end if attributes.has_key?(:'expiryYear') self.expiry_year = attributes[:'expiryYear'] end if attributes.has_key?(:'expiryMonth') self.expiry_month = attributes[:'expiryMonth'] end if attributes.has_key?(:'linkID') self.link_id = attributes[:'linkID'] end if attributes.has_key?(:'gateway') self.gateway = attributes[:'gateway'] end if attributes.has_key?(:'ipAddress') self.ip_address = attributes[:'ipAddress'] end if attributes.has_key?(:'ipAddressCountry') self.ip_address_country = attributes[:'ipAddressCountry'] end if attributes.has_key?(:'state') self.state = attributes[:'state'] end if attributes.has_key?(:'deleted') self.deleted = attributes[:'deleted'] else self.deleted = false end if attributes.has_key?(:'defaultPaymentMethod') self.default_payment_method = attributes[:'defaultPaymentMethod'] else self.default_payment_method = false end end |
Instance Attribute Details
#account_id ⇒ Object
{ "description" : "ID of the account associated with the payment-method.", "verbs“: }
34 35 36 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 34 def account_id @account_id end |
#card_holder_name ⇒ Object
{ "description" : "Name of the card holder", "verbs“: }
45 46 47 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 45 def card_holder_name @card_holder_name end |
#card_type ⇒ Object
{ "description" : "Type of the card. In the case of card payment methods this is the payment type, for example VISA, MasterCard.", "verbs“: }
51 52 53 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 51 def card_type @card_type end |
#changed_by ⇒ Object
{ "description" : "ID of the user who last updated the entity.", "verbs":[] }
22 23 24 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 22 def changed_by @changed_by end |
#country ⇒ Object
Returns the value of attribute country.
53 54 55 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 53 def country @country end |
#created ⇒ Object
{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }
19 20 21 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 19 def created @created end |
#crm_id ⇒ Object
{ "description" : "CRM ID of the product-rate-plan.", "verbs":] }
31 32 33 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 31 def crm_id @crm_id end |
#default_payment_method ⇒ Object
{"default" : "false", "description" : "Indicates if this is the default payment method for the account.", "verbs“: }
83 84 85 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 83 def default_payment_method @default_payment_method end |
#deleted ⇒ Object
{"default" : "false", "description" : "Indicates if a payment-method has been retired. If a payment-method has been retired it can still be retrieved using the appropriate flag on API requests. Generally payment-methods will be retired by customers wanting to remove the payment method from their account. Caution should be used when requested deleted payment methods.", "verbs“: }
80 81 82 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 80 def deleted @deleted end |
#description ⇒ Object
{ "description" : "Description of the payment-method.", "verbs“: }
42 43 44 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 42 def description @description end |
#expiry_date ⇒ Object
{ "description" : "In the case of card payment methods this is the expiry date of the card, format should be MMYY including leading 0’s. For example 0115 for January 2015.", "verbs“: }
48 49 50 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 48 def expiry_date @expiry_date end |
#expiry_month ⇒ Object
Returns the value of attribute expiry_month.
63 64 65 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 63 def expiry_month @expiry_month end |
#expiry_year ⇒ Object
Returns the value of attribute expiry_year.
61 62 63 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 61 def expiry_year @expiry_year end |
#first_six ⇒ Object
Returns the value of attribute first_six.
57 58 59 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 57 def first_six @first_six end |
#gateway ⇒ Object
{ "description" : "Gateway type for payment-method.", "verbs“: }
68 69 70 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 68 def gateway @gateway end |
#id ⇒ Object
{ "description" : "ID of the payment-method.", "verbs“: }
28 29 30 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 28 def id @id end |
#ip_address ⇒ Object
address associated with this payment method.“,”verbs“:
71 72 73 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 71 def ip_address @ip_address end |
#ip_address_country ⇒ Object
of the IP address associated with this payment method.“,”verbs“:
74 75 76 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 74 def ip_address_country @ip_address_country end |
#last_four ⇒ Object
Returns the value of attribute last_four.
59 60 61 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 59 def last_four @last_four end |
#link_id ⇒ Object
Returns the value of attribute link_id.
65 66 67 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 65 def link_id @link_id end |
#name ⇒ Object
{ "description" : "Name of the payment-method.", "verbs“: }
39 40 41 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 39 def name @name end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
36 37 38 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 36 def organization_id @organization_id end |
#province ⇒ Object
Returns the value of attribute province.
55 56 57 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 55 def province @province end |
#state ⇒ Object
{ "description" : "State of the payment-method.", "verbs“: }
77 78 79 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 77 def state @state end |
#updated ⇒ Object
{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }
25 26 27 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 25 def updated @updated end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
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 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 108 def self.attribute_map { :'created' => :'created', :'changed_by' => :'changedBy', :'updated' => :'updated', :'id' => :'id', :'crm_id' => :'crmID', :'account_id' => :'accountID', :'organization_id' => :'organizationID', :'name' => :'name', :'description' => :'description', :'card_holder_name' => :'cardHolderName', :'expiry_date' => :'expiryDate', :'card_type' => :'cardType', :'country' => :'country', :'province' => :'province', :'first_six' => :'firstSix', :'last_four' => :'lastFour', :'expiry_year' => :'expiryYear', :'expiry_month' => :'expiryMonth', :'link_id' => :'linkID', :'gateway' => :'gateway', :'ip_address' => :'ipAddress', :'ip_address_country' => :'ipAddressCountry', :'state' => :'state', :'deleted' => :'deleted', :'default_payment_method' => :'defaultPaymentMethod' } end |
.swagger_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 139 def self.swagger_types { :'created' => :'DateTime', :'changed_by' => :'String', :'updated' => :'DateTime', :'id' => :'String', :'crm_id' => :'String', :'account_id' => :'String', :'organization_id' => :'String', :'name' => :'String', :'description' => :'String', :'card_holder_name' => :'String', :'expiry_date' => :'String', :'card_type' => :'String', :'country' => :'String', :'province' => :'String', :'first_six' => :'String', :'last_four' => :'String', :'expiry_year' => :'Integer', :'expiry_month' => :'Integer', :'link_id' => :'String', :'gateway' => :'String', :'ip_address' => :'String', :'ip_address_country' => :'String', :'state' => :'String', :'deleted' => :'BOOLEAN', :'default_payment_method' => :'BOOLEAN' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
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 377 378 379 380 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 352 def ==(o) return true if self.equal?(o) self.class == o.class && created == o.created && changed_by == o.changed_by && updated == o.updated && id == o.id && crm_id == o.crm_id && account_id == o.account_id && organization_id == o.organization_id && name == o.name && description == o.description && card_holder_name == o.card_holder_name && expiry_date == o.expiry_date && card_type == o.card_type && country == o.country && province == o.province && first_six == o.first_six && last_four == o.last_four && expiry_year == o.expiry_year && expiry_month == o.expiry_month && link_id == o.link_id && gateway == o.gateway && ip_address == o.ip_address && ip_address_country == o.ip_address_country && state == o.state && deleted == o.deleted && default_payment_method == o.default_payment_method end |
#_deserialize(type, value) ⇒ Object
Deserializes the data based on type
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 418 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 = Bfwd.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
484 485 486 487 488 489 490 491 492 493 494 495 496 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 484 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
397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 397 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
384 385 386 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 384 def eql?(o) self == o end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
390 391 392 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 390 def hash [created, changed_by, updated, id, crm_id, account_id, organization_id, name, description, card_holder_name, expiry_date, card_type, country, province, first_six, last_four, expiry_year, expiry_month, link_id, gateway, ip_address, ip_address_country, state, deleted, default_payment_method].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 285 def list_invalid_properties invalid_properties = Array.new if @account_id.nil? invalid_properties.push("invalid value for 'account_id', account_id cannot be nil.") end if @name.nil? invalid_properties.push("invalid value for 'name', name cannot be nil.") end if @expiry_date.nil? invalid_properties.push("invalid value for 'expiry_date', expiry_date cannot be nil.") end if @link_id.nil? invalid_properties.push("invalid value for 'link_id', link_id cannot be nil.") end if @gateway.nil? invalid_properties.push("invalid value for 'gateway', gateway cannot be nil.") end if @state.nil? invalid_properties.push("invalid value for 'state', state cannot be nil.") end return invalid_properties end |
#to_body ⇒ Hash
to_body is an alias to to_hash (backward compatibility)
464 465 466 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 464 def to_body to_hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
470 471 472 473 474 475 476 477 478 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 470 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_s ⇒ String
Returns the string representation of the object
458 459 460 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 458 def to_s to_hash.to_s end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
316 317 318 319 320 321 322 323 324 325 326 327 328 |
# File 'lib/bf_ruby2/models/payment_method.rb', line 316 def valid? return false if @account_id.nil? return false if @name.nil? return false if @expiry_date.nil? return false if @link_id.nil? return false if @gateway.nil? gateway_validator = EnumAttributeValidator.new('String', ["cybersource_token", "card_vault", "paypal_simple", "locustworld", "free", "coupon", "credit_note", "stripe", "braintree", "balanced", "paypal", "billforward_test", "offline", "trial", "stripeACH", "authorizeNet", "spreedly", "sagePay", "trustCommerce", "payvision", "kash"]) return false unless gateway_validator.valid?(@gateway) return false if @state.nil? state_validator = EnumAttributeValidator.new('String', ["Pending", "Active", "Expiring", "Expired"]) return false unless state_validator.valid?(@state) return true end |