Class: Io::Flow::V0::Models::UnitOfTime
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::UnitOfTime
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
- .ALL ⇒ Object
-
.apply(value) ⇒ Object
Returns the instance of UnitOfTime for this value, creating a new instance for an unknown value.
- .day ⇒ Object
-
.from_string(value) ⇒ Object
Returns the instance of UnitOfTime for this value, or nil if not found.
- .hour ⇒ Object
- .minute ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ UnitOfTime
constructor
A new instance of UnitOfTime.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ UnitOfTime
Returns a new instance of UnitOfTime.
5672 5673 5674 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5672 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
5670 5671 5672 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5670 def value @value end |
Class Method Details
.ALL ⇒ Object
5692 5693 5694 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5692 def UnitOfTime.ALL @@all ||= [UnitOfTime.day, UnitOfTime.hour, UnitOfTime.minute] end |
.apply(value) ⇒ Object
Returns the instance of UnitOfTime for this value, creating a new instance for an unknown value
5677 5678 5679 5680 5681 5682 5683 5684 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5677 def UnitOfTime.apply(value) if value.instance_of?(UnitOfTime) value else HttpClient::Preconditions.assert_class_or_nil('value', value, String) value.nil? ? nil : (from_string(value) || UnitOfTime.new(value)) end end |
.day ⇒ Object
5696 5697 5698 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5696 def UnitOfTime.day @@_day ||= UnitOfTime.new('day') end |
.from_string(value) ⇒ Object
Returns the instance of UnitOfTime for this value, or nil if not found
5687 5688 5689 5690 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5687 def UnitOfTime.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) UnitOfTime.ALL.find { |v| v.value == value } end |
.hour ⇒ Object
5700 5701 5702 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5700 def UnitOfTime.hour @@_hour ||= UnitOfTime.new('hour') end |
.minute ⇒ Object
5704 5705 5706 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5704 def UnitOfTime.minute @@_minute ||= UnitOfTime.new('minute') end |
Instance Method Details
#to_hash ⇒ Object
5708 5709 5710 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 5708 def to_hash value end |