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.



14082
14083
14084
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14082

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14080
14081
14082
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14080

def value
  @value
end

Class Method Details

.ALLObject



14102
14103
14104
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14102

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



14106
14107
14108
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14106

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



14087
14088
14089
14090
14091
14092
14093
14094
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14087

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



14110
14111
14112
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14110

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

.china_union_payObject



14114
14115
14116
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14114

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

.dankortObject



14118
14119
14120
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14118

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

.diners_clubObject



14122
14123
14124
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14122

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

.discoverObject



14126
14127
14128
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14126

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



14097
14098
14099
14100
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14097

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

.jcbObject



14130
14131
14132
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14130

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

.maestroObject



14134
14135
14136
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14134

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

.mastercardObject



14138
14139
14140
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14138

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

.visaObject



14142
14143
14144
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14142

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

Instance Method Details

#to_hashObject



14146
14147
14148
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14146

def to_hash
  value
end