Class: Braintree::MetaCheckoutToken
- Inherits:
-
Object
- Object
- Braintree::MetaCheckoutToken
- Includes:
- BaseModule, Util::TokenEquality
- Defined in:
- lib/braintree/meta_checkout_token.rb
Instance Attribute Summary collapse
-
#bin ⇒ Object
readonly
Returns the value of attribute bin.
-
#card_type ⇒ Object
readonly
Returns the value of attribute card_type.
-
#cardholder_name ⇒ Object
readonly
Returns the value of attribute cardholder_name.
-
#commercial ⇒ Object
readonly
Returns the value of attribute commercial.
-
#container_id ⇒ Object
readonly
Returns the value of attribute container_id.
-
#country_of_issuance ⇒ Object
readonly
Returns the value of attribute country_of_issuance.
-
#created_at ⇒ Object
readonly
Returns the value of attribute created_at.
-
#cryptogram ⇒ Object
readonly
Returns the value of attribute cryptogram.
-
#customer_id ⇒ Object
readonly
Returns the value of attribute customer_id.
-
#customer_location ⇒ Object
readonly
Returns the value of attribute customer_location.
-
#debit ⇒ Object
readonly
Returns the value of attribute debit.
-
#durbin_regulated ⇒ Object
readonly
Returns the value of attribute durbin_regulated.
-
#ecommerce_indicator ⇒ Object
readonly
Returns the value of attribute ecommerce_indicator.
-
#expiration_month ⇒ Object
readonly
Returns the value of attribute expiration_month.
-
#expiration_year ⇒ Object
readonly
Returns the value of attribute expiration_year.
-
#healthcare ⇒ Object
readonly
Returns the value of attribute healthcare.
-
#image_url ⇒ Object
readonly
Returns the value of attribute image_url.
-
#issuing_bank ⇒ Object
readonly
Returns the value of attribute issuing_bank.
-
#last_4 ⇒ Object
readonly
Returns the value of attribute last_4.
-
#payroll ⇒ Object
readonly
Returns the value of attribute payroll.
-
#prepaid ⇒ Object
readonly
Returns the value of attribute prepaid.
-
#product_id ⇒ Object
readonly
Returns the value of attribute product_id.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
-
#unique_number_identifier ⇒ Object
readonly
Returns the value of attribute unique_number_identifier.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
-
#verification ⇒ Object
readonly
Returns the value of attribute verification.
Class Method Summary collapse
-
._attributes ⇒ Object
:nodoc:.
-
._new(*args) ⇒ Object
:nodoc:.
Instance Method Summary collapse
- #_most_recent_verification(attributes) ⇒ Object
- #default? ⇒ Boolean
-
#expiration_date ⇒ Object
Expiration date formatted as MM/YYYY.
- #expired? ⇒ Boolean
-
#initialize(gateway, attributes) ⇒ MetaCheckoutToken
constructor
:nodoc:.
-
#inspect ⇒ Object
:nodoc:.
- #masked_number ⇒ Object
Methods included from Util::TokenEquality
Methods included from BaseModule
Methods included from BaseModule::Methods
#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class
Constructor Details
#initialize(gateway, attributes) ⇒ MetaCheckoutToken
:nodoc:
33 34 35 36 37 |
# File 'lib/braintree/meta_checkout_token.rb', line 33 def initialize(gateway, attributes) # :nodoc: @gateway = gateway set_instance_variables_from_hash(attributes) @verification = _most_recent_verification(attributes) end |
Instance Attribute Details
#bin ⇒ Object (readonly)
Returns the value of attribute bin.
6 7 8 |
# File 'lib/braintree/meta_checkout_token.rb', line 6 def bin @bin end |
#card_type ⇒ Object (readonly)
Returns the value of attribute card_type.
8 9 10 |
# File 'lib/braintree/meta_checkout_token.rb', line 8 def card_type @card_type end |
#cardholder_name ⇒ Object (readonly)
Returns the value of attribute cardholder_name.
9 10 11 |
# File 'lib/braintree/meta_checkout_token.rb', line 9 def cardholder_name @cardholder_name end |
#commercial ⇒ Object (readonly)
Returns the value of attribute commercial.
10 11 12 |
# File 'lib/braintree/meta_checkout_token.rb', line 10 def commercial @commercial end |
#container_id ⇒ Object (readonly)
Returns the value of attribute container_id.
7 8 9 |
# File 'lib/braintree/meta_checkout_token.rb', line 7 def container_id @container_id end |
#country_of_issuance ⇒ Object (readonly)
Returns the value of attribute country_of_issuance.
11 12 13 |
# File 'lib/braintree/meta_checkout_token.rb', line 11 def country_of_issuance @country_of_issuance end |
#created_at ⇒ Object (readonly)
Returns the value of attribute created_at.
12 13 14 |
# File 'lib/braintree/meta_checkout_token.rb', line 12 def created_at @created_at end |
#cryptogram ⇒ Object (readonly)
Returns the value of attribute cryptogram.
13 14 15 |
# File 'lib/braintree/meta_checkout_token.rb', line 13 def cryptogram @cryptogram end |
#customer_id ⇒ Object (readonly)
Returns the value of attribute customer_id.
14 15 16 |
# File 'lib/braintree/meta_checkout_token.rb', line 14 def customer_id @customer_id end |
#customer_location ⇒ Object (readonly)
Returns the value of attribute customer_location.
15 16 17 |
# File 'lib/braintree/meta_checkout_token.rb', line 15 def customer_location @customer_location end |
#debit ⇒ Object (readonly)
Returns the value of attribute debit.
16 17 18 |
# File 'lib/braintree/meta_checkout_token.rb', line 16 def debit @debit end |
#durbin_regulated ⇒ Object (readonly)
Returns the value of attribute durbin_regulated.
17 18 19 |
# File 'lib/braintree/meta_checkout_token.rb', line 17 def durbin_regulated @durbin_regulated end |
#ecommerce_indicator ⇒ Object (readonly)
Returns the value of attribute ecommerce_indicator.
18 19 20 |
# File 'lib/braintree/meta_checkout_token.rb', line 18 def ecommerce_indicator @ecommerce_indicator end |
#expiration_month ⇒ Object (readonly)
Returns the value of attribute expiration_month.
19 20 21 |
# File 'lib/braintree/meta_checkout_token.rb', line 19 def expiration_month @expiration_month end |
#expiration_year ⇒ Object (readonly)
Returns the value of attribute expiration_year.
20 21 22 |
# File 'lib/braintree/meta_checkout_token.rb', line 20 def expiration_year @expiration_year end |
#healthcare ⇒ Object (readonly)
Returns the value of attribute healthcare.
21 22 23 |
# File 'lib/braintree/meta_checkout_token.rb', line 21 def healthcare @healthcare end |
#image_url ⇒ Object (readonly)
Returns the value of attribute image_url.
22 23 24 |
# File 'lib/braintree/meta_checkout_token.rb', line 22 def image_url @image_url end |
#issuing_bank ⇒ Object (readonly)
Returns the value of attribute issuing_bank.
23 24 25 |
# File 'lib/braintree/meta_checkout_token.rb', line 23 def issuing_bank @issuing_bank end |
#last_4 ⇒ Object (readonly)
Returns the value of attribute last_4.
24 25 26 |
# File 'lib/braintree/meta_checkout_token.rb', line 24 def last_4 @last_4 end |
#payroll ⇒ Object (readonly)
Returns the value of attribute payroll.
25 26 27 |
# File 'lib/braintree/meta_checkout_token.rb', line 25 def payroll @payroll end |
#prepaid ⇒ Object (readonly)
Returns the value of attribute prepaid.
26 27 28 |
# File 'lib/braintree/meta_checkout_token.rb', line 26 def prepaid @prepaid end |
#product_id ⇒ Object (readonly)
Returns the value of attribute product_id.
27 28 29 |
# File 'lib/braintree/meta_checkout_token.rb', line 27 def product_id @product_id end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
28 29 30 |
# File 'lib/braintree/meta_checkout_token.rb', line 28 def token @token end |
#unique_number_identifier ⇒ Object (readonly)
Returns the value of attribute unique_number_identifier.
29 30 31 |
# File 'lib/braintree/meta_checkout_token.rb', line 29 def unique_number_identifier @unique_number_identifier end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
30 31 32 |
# File 'lib/braintree/meta_checkout_token.rb', line 30 def updated_at @updated_at end |
#verification ⇒ Object (readonly)
Returns the value of attribute verification.
31 32 33 |
# File 'lib/braintree/meta_checkout_token.rb', line 31 def verification @verification end |
Class Method Details
._attributes ⇒ Object
:nodoc:
74 75 76 77 78 79 80 81 82 |
# File 'lib/braintree/meta_checkout_token.rb', line 74 def self._attributes # :nodoc: [ :bin, :card_type, :cardholder_name, :created_at, :customer_id, :customer_location, :expiration_month, :expiration_year, :last_4, :token, :updated_at, :prepaid, :payroll, :product_id, :commercial, :debit, :durbin_regulated, :healthcare, :ecommerce_indicator, :country_of_issuance, :issuing_bank, :image_url, :container_id, :cryptogram ] end |
._new(*args) ⇒ Object
:nodoc:
84 85 86 |
# File 'lib/braintree/meta_checkout_token.rb', line 84 def self._new(*args) # :nodoc: self.new(*args) end |
Instance Method Details
#_most_recent_verification(attributes) ⇒ Object
39 40 41 42 |
# File 'lib/braintree/meta_checkout_token.rb', line 39 def _most_recent_verification(attributes) verification = (attributes[:verifications] || []).sort_by { |v| v[:created_at] }.reverse.first CreditCardVerification._new(verification) if verification end |
#default? ⇒ Boolean
44 45 46 |
# File 'lib/braintree/meta_checkout_token.rb', line 44 def default? @default end |
#expiration_date ⇒ Object
Expiration date formatted as MM/YYYY
49 50 51 |
# File 'lib/braintree/meta_checkout_token.rb', line 49 def expiration_date "#{expiration_month}/#{expiration_year}" end |
#expired? ⇒ Boolean
53 54 55 |
# File 'lib/braintree/meta_checkout_token.rb', line 53 def expired? @expired end |
#inspect ⇒ Object
:nodoc:
57 58 59 60 61 62 63 64 |
# File 'lib/braintree/meta_checkout_token.rb', line 57 def inspect # :nodoc: first = [:token] order = first + (self.class._attributes - first) nice_attributes = order.map do |attr| "#{attr}: #{send(attr).inspect}" end "#<#{self.class} #{nice_attributes.join(', ')}>" end |
#masked_number ⇒ Object
66 67 68 |
# File 'lib/braintree/meta_checkout_token.rb', line 66 def masked_number "#{bin}******#{last_4}" end |