Class: Io::Flow::V0::Models::PaymentMethodType

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



14800
14801
14802
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14800

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



14798
14799
14800
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14798

def value
  @value
end

Class Method Details

.ALLObject



14820
14821
14822
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14820

def PaymentMethodType.ALL
  @@all ||= [PaymentMethodType.card, PaymentMethodType.online, PaymentMethodType.offline]
end

.apply(value) ⇒ Object

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



14805
14806
14807
14808
14809
14810
14811
14812
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14805

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

.cardObject

Represents all form of card payment (e.g. credit, debit, etc.)



14825
14826
14827
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14825

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

.from_string(value) ⇒ Object

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



14815
14816
14817
14818
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14815

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

.offlineObject

Offline payment method types represent payments like Cash On Delivery which require offline collection



14837
14838
14839
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14837

def PaymentMethodType.offline
  @@_offline ||= PaymentMethodType.new('offline')
end

.onlineObject

Represents the most common form of alternative payment methods which require some degree of integration online (e.g. a redirect) to complete payment.



14831
14832
14833
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14831

def PaymentMethodType.online
  @@_online ||= PaymentMethodType.new('online')
end

Instance Method Details

#to_hashObject



14841
14842
14843
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14841

def to_hash
  value
end