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.



20587
20588
20589
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20587

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



20585
20586
20587
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20585

def value
  @value
end

Class Method Details

.ALLObject



20607
20608
20609
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20607

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



20592
20593
20594
20595
20596
20597
20598
20599
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20592

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



20622
20623
20624
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20622

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

.flow_irlObject

Flow Commerce Ltd., Dublin, IRL



20617
20618
20619
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20617

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

.flow_usaObject

Flow Commerce Inc., Hoboken, NJ, USA



20612
20613
20614
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20612

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



20602
20603
20604
20605
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20602

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



20626
20627
20628
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20626

def to_hash
  value
end