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

Returns a new instance of FlowEntity.



18336
18337
18338
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18336

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18334
18335
18336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18334

def value
  @value
end

Class Method Details

.ALLObject



18356
18357
18358
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18356

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



18341
18342
18343
18344
18345
18346
18347
18348
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18341

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



18371
18372
18373
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18371

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

.flow_irlObject

Flow Commerce Ltd., Dublin, IRL



18366
18367
18368
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18366

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

.flow_usaObject

Flow Commerce Inc., Hoboken, NJ, USA



18361
18362
18363
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18361

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



18351
18352
18353
18354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18351

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



18375
18376
18377
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18375

def to_hash
  value
end