Class: Lightrail::LightrailValue

Inherits:
LightrailObject
  • Object
show all
Defined in:
lib/lightrail_stripe/wrappers/lightrail_value.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#asAtDateObject

Returns the value of attribute asAtDate.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 3

def asAtDate
  @asAtDate
end

#cardIdObject

Returns the value of attribute cardId.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 3

def cardId
  @cardId
end

#cardTypeObject

Returns the value of attribute cardType.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 3

def cardType
  @cardType
end

#currencyObject

Returns the value of attribute currency.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 3

def currency
  @currency
end

#valueStoresObject

Returns the value of attribute valueStores.



3
4
5
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 3

def valueStores
  @valueStores
end

Class Method Details

.retrieve_by_shopper_id(shopper_id, currency) ⇒ Object



24
25
26
27
28
29
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 24

def self.retrieve_by_shopper_id (shopper_id, currency)
  Lightrail::Validator.validate_shopper_id!(shopper_id)
  Lightrail::Validator.validate_currency!(currency)
  response = Lightrail::Account.({shopper_id: shopper_id, currency: currency})
  self.new(response)
end

.retrieve_card_details(card_id) ⇒ Object



11
12
13
14
15
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 11

def self.retrieve_card_details (card_id)
  Lightrail::Validator.validate_card_id!(card_id)
  response = Lightrail::Card.get_details(card_id)
  self.new(response)
end

.retrieve_code_details(code) ⇒ Object



5
6
7
8
9
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 5

def self.retrieve_code_details (code)
  Lightrail::Validator.validate_code! (code)
  response = Lightrail::Code.get_details(code)
  self.new(response)
end

.retrieve_contact_account_details(contact_id, currency) ⇒ Object



17
18
19
20
21
22
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 17

def self. (contact_id, currency)
  Lightrail::Validator.validate_contact_id!(contact_id)
  Lightrail::Validator.validate_currency!(currency)
  response = Lightrail::Account.({contact_id: contact_id, currency: currency})
  self.new(response)
end

Instance Method Details

#maximum_valueObject



32
33
34
35
36
37
38
39
40
# File 'lib/lightrail_stripe/wrappers/lightrail_value.rb', line 32

def maximum_value
  maximum_value = 0
  self.valueStores.each do |valueStore|
    if valueStore['state'] == 'ACTIVE'
      maximum_value += valueStore['value']
    end
  end
  maximum_value
end