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.



16495
16496
16497
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16495

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



16493
16494
16495
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16493

def value
  @value
end

Class Method Details

.ALLObject



16515
16516
16517
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16515

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



16500
16501
16502
16503
16504
16505
16506
16507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16500

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



16530
16531
16532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16530

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

.flow_irlObject

Flow Commerce Ltd., Dublin, IRL



16525
16526
16527
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16525

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

.flow_usaObject

Flow Commerce Inc., Hoboken, NJ, USA



16520
16521
16522
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16520

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



16510
16511
16512
16513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16510

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



16534
16535
16536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 16534

def to_hash
  value
end