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.



13358
13359
13360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13358

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13356
13357
13358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13356

def value
  @value
end

Class Method Details

.ALLObject



13378
13379
13380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13378

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



13363
13364
13365
13366
13367
13368
13369
13370
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13363

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



13383
13384
13385
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13383

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



13373
13374
13375
13376
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13373

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



13395
13396
13397
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13395

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.



13389
13390
13391
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13389

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

Instance Method Details

#to_hashObject



13399
13400
13401
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13399

def to_hash
  value
end