Class: Io::Flow::V0::Models::RateType

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

Returns a new instance of RateType.



17458
17459
17460
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17458

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



17456
17457
17458
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17456

def value
  @value
end

Class Method Details

.ALLObject



17478
17479
17480
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17478

def RateType.ALL
  @@all ||= [RateType.flow, RateType.organization]
end

.apply(value) ⇒ Object

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



17463
17464
17465
17466
17467
17468
17469
17470
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17463

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

.flowObject

Represents a Flow rate type (which excludes currency margins)



17483
17484
17485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17483

def RateType.flow
  @@_flow ||= RateType.new('flow')
end

.from_string(value) ⇒ Object

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



17473
17474
17475
17476
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17473

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

.organizationObject

Represents an organization rate type (which includes currency margins)



17488
17489
17490
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17488

def RateType.organization
  @@_organization ||= RateType.new('organization')
end

Instance Method Details

#to_hashObject



17492
17493
17494
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 17492

def to_hash
  value
end