Class: Io::Flow::V0::Models::CardType

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ CardType

Returns a new instance of CardType.



7022
7023
7024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7022

def initialize(value)
  @value = HttpClient::Preconditions.assert_class('value', value, String)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7020
7021
7022
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7020

def value
  @value
end

Class Method Details

.ALLObject



7042
7043
7044
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7042

def CardType.ALL
  @@all ||= [CardType.american_express, CardType.cartes_bancaires, CardType.china_union_pay, CardType.dankort, CardType.diners_club, CardType.discover, CardType.jcb, CardType.maestro, CardType.mastercard, CardType.visa]
end

.american_expressObject



7046
7047
7048
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7046

def CardType.american_express
  @@_american_express ||= CardType.new('american_express')
end

.apply(value) ⇒ Object

Returns the instance of CardType for this value, creating a new instance for an unknown value



7027
7028
7029
7030
7031
7032
7033
7034
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7027

def CardType.apply(value)
  if value.instance_of?(CardType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || CardType.new(value))
  end
end

.cartes_bancairesObject



7050
7051
7052
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7050

def CardType.cartes_bancaires
  @@_cartes_bancaires ||= CardType.new('cartes_bancaires')
end

.china_union_payObject



7054
7055
7056
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7054

def CardType.china_union_pay
  @@_china_union_pay ||= CardType.new('china_union_pay')
end

.dankortObject



7058
7059
7060
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7058

def CardType.dankort
  @@_dankort ||= CardType.new('dankort')
end

.diners_clubObject



7062
7063
7064
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7062

def CardType.diners_club
  @@_diners_club ||= CardType.new('diners_club')
end

.discoverObject



7066
7067
7068
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7066

def CardType.discover
  @@_discover ||= CardType.new('discover')
end

.from_string(value) ⇒ Object

Returns the instance of CardType for this value, or nil if not found



7037
7038
7039
7040
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7037

def CardType.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  CardType.ALL.find { |v| v.value == value }
end

.jcbObject



7070
7071
7072
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7070

def CardType.jcb
  @@_jcb ||= CardType.new('jcb')
end

.maestroObject



7074
7075
7076
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7074

def CardType.maestro
  @@_maestro ||= CardType.new('maestro')
end

.mastercardObject



7078
7079
7080
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7078

def CardType.mastercard
  @@_mastercard ||= CardType.new('mastercard')
end

.visaObject



7082
7083
7084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7082

def CardType.visa
  @@_visa ||= CardType.new('visa')
end

Instance Method Details

#to_hashObject



7086
7087
7088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7086

def to_hash
  value
end