Class: QuickTravel::PaymentType

Inherits:
Adapter
  • Object
show all
Defined in:
lib/quick_travel/payment_type.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Adapter

all, belongs_to, create, find, has_many, #to_s, update

Methods included from InitFromHash

#define_readers, #initialize, #to_hash

Class Method Details

.informationObject



25
26
27
# File 'lib/quick_travel/payment_type.rb', line 25

def self.information
  get_and_validate('/api/payment_types/information.json')
end

Instance Method Details

#as_json(options = nil) ⇒ Object



21
22
23
# File 'lib/quick_travel/payment_type.rb', line 21

def as_json(options = nil)
  super.merge(code: code)
end

#codeObject



13
14
15
16
17
18
19
# File 'lib/quick_travel/payment_type.rb', line 13

def code
  if credit_card
    credit_card_brand.underscore.gsub(/\s/, '_')
  else
    payment_method
  end
end

#credit_cardObject



9
10
11
# File 'lib/quick_travel/payment_type.rb', line 9

def credit_card
  payment_method == 'credit_card'
end