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.



10190
10191
10192
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10190

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



10188
10189
10190
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10188

def value
  @value
end

Class Method Details

.ALLObject



10210
10211
10212
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10210

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



10195
10196
10197
10198
10199
10200
10201
10202
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10195

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



10215
10216
10217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10215

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



10205
10206
10207
10208
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10205

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



10227
10228
10229
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10227

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.



10221
10222
10223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10221

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

Instance Method Details

#to_hashObject



10231
10232
10233
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 10231

def to_hash
  value
end