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.



9897
9898
9899
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9897

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9895
9896
9897
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9895

def value
  @value
end

Class Method Details

.ALLObject



9917
9918
9919
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9917

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



9921
9922
9923
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9921

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



9902
9903
9904
9905
9906
9907
9908
9909
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9902

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



9925
9926
9927
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9925

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

.china_union_payObject



9929
9930
9931
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9929

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

.dankortObject



9933
9934
9935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9933

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

.diners_clubObject



9937
9938
9939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9937

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

.discoverObject



9941
9942
9943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9941

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



9912
9913
9914
9915
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9912

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

.jcbObject



9945
9946
9947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9945

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

.maestroObject



9949
9950
9951
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9949

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

.mastercardObject



9953
9954
9955
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9953

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

.visaObject



9957
9958
9959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9957

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

Instance Method Details

#to_hashObject



9961
9962
9963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9961

def to_hash
  value
end