Class: Io::Flow::V0::Models::PaymentType

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) ⇒ PaymentType

Returns a new instance of PaymentType.



21720
21721
21722
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21720

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



21718
21719
21720
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21718

def value
  @value
end

Class Method Details

.afterpayObject



21768
21769
21770
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21768

def PaymentType.afterpay
  @@_afterpay ||= PaymentType.new('afterpay')
end

.ALLObject



21740
21741
21742
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21740

def PaymentType.ALL
  @@all ||= [PaymentType.card, PaymentType.klarna, PaymentType.googlepay, PaymentType.paypal, PaymentType.applepay, PaymentType.ideal, PaymentType.afterpay]
end

.applepayObject



21760
21761
21762
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21760

def PaymentType.applepay
  @@_applepay ||= PaymentType.new('applepay')
end

.apply(value) ⇒ Object

Returns the instance of PaymentType for this value, creating a new instance for an unknown value



21725
21726
21727
21728
21729
21730
21731
21732
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21725

def PaymentType.apply(value)
  if value.instance_of?(PaymentType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || PaymentType.new(value))
  end
end

.cardObject



21744
21745
21746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21744

def PaymentType.card
  @@_card ||= PaymentType.new('card')
end

.from_string(value) ⇒ Object

Returns the instance of PaymentType for this value, or nil if not found



21735
21736
21737
21738
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21735

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

.googlepayObject



21752
21753
21754
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21752

def PaymentType.googlepay
  @@_googlepay ||= PaymentType.new('googlepay')
end

.idealObject



21764
21765
21766
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21764

def PaymentType.ideal
  @@_ideal ||= PaymentType.new('ideal')
end

.klarnaObject



21748
21749
21750
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21748

def PaymentType.klarna
  @@_klarna ||= PaymentType.new('klarna')
end

.paypalObject



21756
21757
21758
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21756

def PaymentType.paypal
  @@_paypal ||= PaymentType.new('paypal')
end

Instance Method Details

#to_hashObject



21772
21773
21774
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 21772

def to_hash
  value
end