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.



7947
7948
7949
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7947

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



7945
7946
7947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7945

def value
  @value
end

Class Method Details

.ALLObject



7967
7968
7969
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7967

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



7971
7972
7973
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7971

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



7952
7953
7954
7955
7956
7957
7958
7959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7952

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



7975
7976
7977
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7975

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

.china_union_payObject



7979
7980
7981
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7979

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

.dankortObject



7983
7984
7985
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7983

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

.diners_clubObject



7987
7988
7989
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7987

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

.discoverObject



7991
7992
7993
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7991

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



7962
7963
7964
7965
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7962

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

.jcbObject



7995
7996
7997
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7995

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

.maestroObject



7999
8000
8001
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7999

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

.mastercardObject



8003
8004
8005
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8003

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

.visaObject



8007
8008
8009
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8007

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

Instance Method Details

#to_hashObject



8011
8012
8013
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8011

def to_hash
  value
end