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.



9600
9601
9602
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9600

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9598
9599
9600
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9598

def value
  @value
end

Class Method Details

.ALLObject



9620
9621
9622
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9620

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



9605
9606
9607
9608
9609
9610
9611
9612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9605

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



9625
9626
9627
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9625

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



9615
9616
9617
9618
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9615

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



9637
9638
9639
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9637

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.



9631
9632
9633
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9631

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

Instance Method Details

#to_hashObject



9641
9642
9643
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9641

def to_hash
  value
end