Class: Io::Flow::V0::Models::OrderPaymentType

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) ⇒ OrderPaymentType



9329
9330
9331
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9329

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



9327
9328
9329
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9327

def value
  @value
end

Class Method Details

.ALLObject



9349
9350
9351
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9349

def OrderPaymentType.ALL
  @@all ||= [OrderPaymentType.card, OrderPaymentType.online, OrderPaymentType.credit, OrderPaymentType.cash_on_delivery]
end

.apply(value) ⇒ Object

Returns the instance of OrderPaymentType for this value, creating a new instance for an unknown value



9334
9335
9336
9337
9338
9339
9340
9341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9334

def OrderPaymentType.apply(value)
  if value.instance_of?(OrderPaymentType)
    value
  else
    HttpClient::Preconditions.assert_class_or_nil('value', value, String)
    value.nil? ? nil : (from_string(value) || OrderPaymentType.new(value))
  end
end

.cardObject

Represents a payment in the form of a credit or debit card



9354
9355
9356
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9354

def OrderPaymentType.card
  @@_card ||= OrderPaymentType.new('card')
end

.cash_on_deliveryObject

Request to pay the balance with cash on delivery. Offered only when the final mile carriers support cash on delivery.



9371
9372
9373
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9371

def OrderPaymentType.cash_on_delivery
  @@_cash_on_delivery ||= OrderPaymentType.new('cash_on_delivery')
end

.creditObject

A payment in the form of a credit of some type (e.g. a store credit, gift card) applied to an order



9365
9366
9367
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9365

def OrderPaymentType.credit
  @@_credit ||= OrderPaymentType.new('credit')
end

.from_string(value) ⇒ Object

Returns the instance of OrderPaymentType for this value, or nil if not found



9344
9345
9346
9347
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9344

def OrderPaymentType.from_string(value)
  HttpClient::Preconditions.assert_class('value', value, String)
  OrderPaymentType.ALL.find { |v| v.value == value }
end

.onlineObject

Represents an online payment (e.g. paypal, alipay, etc)



9359
9360
9361
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9359

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

Instance Method Details

#to_hashObject



9375
9376
9377
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9375

def to_hash
  value
end