Class: Io::Flow::V0::Models::FlowEntity

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



16319
16320
16321
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16319

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16317
16318
16319
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16317

def value
  @value
end

Class Method Details

.ALLObject



16339
16340
16341
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16339

def FlowEntity.ALL
  @@all ||= [FlowEntity.flow_usa, FlowEntity.flow_irl, FlowEntity.flow_can]
end

.apply(value) ⇒ Object

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



16324
16325
16326
16327
16328
16329
16330
16331
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16324

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

.flow_canObject

Flow Commerce Canada Inc., Vancouver, BC, CAN



16354
16355
16356
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16354

def FlowEntity.flow_can
  @@_flow_can ||= FlowEntity.new('flow-can')
end

.flow_irlObject

Flow Commerce Ltd., Dublin, IRL



16349
16350
16351
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16349

def FlowEntity.flow_irl
  @@_flow_irl ||= FlowEntity.new('flow-irl')
end

.flow_usaObject

Flow Commerce Inc., Hoboken, NJ, USA



16344
16345
16346
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16344

def FlowEntity.flow_usa
  @@_flow_usa ||= FlowEntity.new('flow-usa')
end

.from_string(value) ⇒ Object

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



16334
16335
16336
16337
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16334

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

Instance Method Details

#to_hashObject



16358
16359
16360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16358

def to_hash
  value
end