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.



4912
4913
4914
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4912

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4910
4911
4912
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4910

def value
  @value
end

Class Method Details

.ALLObject



4932
4933
4934
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4932

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

.american_expressObject



4936
4937
4938
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4936

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



4917
4918
4919
4920
4921
4922
4923
4924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4917

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

.china_union_payObject



4940
4941
4942
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4940

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

.dankortObject



4944
4945
4946
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4944

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

.diners_clubObject



4948
4949
4950
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4948

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

.discoverObject



4952
4953
4954
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4952

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



4927
4928
4929
4930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4927

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

.jcbObject



4956
4957
4958
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4956

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

.maestroObject



4960
4961
4962
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4960

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

.mastercardObject



4964
4965
4966
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4964

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

.visaObject



4968
4969
4970
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4968

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

Instance Method Details

#to_hashObject



4972
4973
4974
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4972

def to_hash
  value
end