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.



12921
12922
12923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12921

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



12919
12920
12921
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12919

def value
  @value
end

Class Method Details

.ALLObject



12941
12942
12943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12941

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



12945
12946
12947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12945

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



12926
12927
12928
12929
12930
12931
12932
12933
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12926

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



12949
12950
12951
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12949

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

.china_union_payObject



12953
12954
12955
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12953

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

.dankortObject



12957
12958
12959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12957

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

.diners_clubObject



12961
12962
12963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12961

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

.discoverObject



12965
12966
12967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12965

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



12936
12937
12938
12939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12936

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

.jcbObject



12969
12970
12971
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12969

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

.maestroObject



12973
12974
12975
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12973

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

.mastercardObject



12977
12978
12979
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12977

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

.visaObject



12981
12982
12983
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12981

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

Instance Method Details

#to_hashObject



12985
12986
12987
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12985

def to_hash
  value
end