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.



15385
15386
15387
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15385

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15383
15384
15385
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15383

def value
  @value
end

Class Method Details

.ALLObject



15405
15406
15407
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15405

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



15390
15391
15392
15393
15394
15395
15396
15397
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15390

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



15410
15411
15412
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15410

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



15400
15401
15402
15403
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15400

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



15422
15423
15424
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15422

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.



15416
15417
15418
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15416

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

Instance Method Details

#to_hashObject



15426
15427
15428
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 15426

def to_hash
  value
end