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.



8878
8879
8880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8878

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8876
8877
8878
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8876

def value
  @value
end

Class Method Details

.ALLObject



8898
8899
8900
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8898

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



8902
8903
8904
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8902

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



8883
8884
8885
8886
8887
8888
8889
8890
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8883

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



8906
8907
8908
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8906

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

.china_union_payObject



8910
8911
8912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8910

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

.dankortObject



8914
8915
8916
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8914

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

.diners_clubObject



8918
8919
8920
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8918

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

.discoverObject



8922
8923
8924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8922

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



8893
8894
8895
8896
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8893

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

.jcbObject



8926
8927
8928
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8926

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

.maestroObject



8930
8931
8932
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8930

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

.mastercardObject



8934
8935
8936
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8934

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

.visaObject



8938
8939
8940
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8938

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

Instance Method Details

#to_hashObject



8942
8943
8944
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8942

def to_hash
  value
end