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

Returns a new instance of PaymentMethodType.



8847
8848
8849
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8847

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



8845
8846
8847
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8845

def value
  @value
end

Class Method Details

.ALLObject



8867
8868
8869
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8867

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



8852
8853
8854
8855
8856
8857
8858
8859
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8852

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.)



8872
8873
8874
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8872

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



8862
8863
8864
8865
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8862

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



8884
8885
8886
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8884

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.



8878
8879
8880
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8878

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

Instance Method Details

#to_hashObject



8888
8889
8890
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8888

def to_hash
  value
end