Class: Io::Flow::V0::Models::FulfillmentMethodValue

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

Returns a new instance of FulfillmentMethodValue.



13145
13146
13147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13145

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



13143
13144
13145
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13143

def value
  @value
end

Class Method Details

.ALLObject



13165
13166
13167
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13165

def FulfillmentMethodValue.ALL
  @@all ||= [FulfillmentMethodValue.digital, FulfillmentMethodValue.physical]
end

.apply(value) ⇒ Object

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



13150
13151
13152
13153
13154
13155
13156
13157
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13150

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

.digitalObject

Indicates item will be fulfilled digitally and no shipment is required (e.g. Gift Card).



13171
13172
13173
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13171

def FulfillmentMethodValue.digital
  @@_digital ||= FulfillmentMethodValue.new('digital')
end

.from_string(value) ⇒ Object

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



13160
13161
13162
13163
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13160

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

.physicalObject

Indicates item will be shipped in a physical package.



13176
13177
13178
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13176

def FulfillmentMethodValue.physical
  @@_physical ||= FulfillmentMethodValue.new('physical')
end

Instance Method Details

#to_hashObject



13180
13181
13182
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13180

def to_hash
  value
end