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.



19328
19329
19330
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19328

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



19326
19327
19328
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19326

def value
  @value
end

Class Method Details

.ALLObject



19348
19349
19350
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19348

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



19333
19334
19335
19336
19337
19338
19339
19340
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19333

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)



19353
19354
19355
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19353

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



19343
19344
19345
19346
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19343

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)



19358
19359
19360
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19358

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

Instance Method Details

#to_hashObject



19362
19363
19364
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 19362

def to_hash
  value
end