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.



18746
18747
18748
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18746

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

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



18744
18745
18746
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18744

def value
  @value
end

Class Method Details

.ALLObject



18766
18767
18768
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18766

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



18751
18752
18753
18754
18755
18756
18757
18758
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18751

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)



18771
18772
18773
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18771

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



18761
18762
18763
18764
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18761

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)



18776
18777
18778
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18776

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

Instance Method Details

#to_hashObject



18780
18781
18782
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 18780

def to_hash
  value
end