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.



4624
4625
4626
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4624

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



4622
4623
4624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4622

def value
  @value
end

Class Method Details

.ALLObject



4644
4645
4646
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4644

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



4648
4649
4650
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4648

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



4629
4630
4631
4632
4633
4634
4635
4636
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4629

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



4652
4653
4654
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4652

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

.dankortObject



4656
4657
4658
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4656

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

.diners_clubObject



4660
4661
4662
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4660

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

.discoverObject



4664
4665
4666
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4664

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



4639
4640
4641
4642
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4639

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

.jcbObject



4668
4669
4670
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4668

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

.maestroObject



4672
4673
4674
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4672

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

.mastercardObject



4676
4677
4678
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4676

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

.visaObject



4680
4681
4682
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4680

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

Instance Method Details

#to_hashObject



4684
4685
4686
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 4684

def to_hash
  value
end