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
- .month ⇒ Object
- .week ⇒ Object
- .year ⇒ Object
Instance Method Summary collapse
-
#initialize(value) ⇒ UnitOfTime
constructor
A new instance of UnitOfTime.
- #to_hash ⇒ Object
Constructor Details
#initialize(value) ⇒ UnitOfTime
26040 26041 26042 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26040 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
26038 26039 26040 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26038 def value @value end |
Class Method Details
.ALL ⇒ Object
26060 26061 26062 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26060 def UnitOfTime.ALL @@all ||= [UnitOfTime.year, UnitOfTime.month, UnitOfTime.week, 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
26045 26046 26047 26048 26049 26050 26051 26052 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26045 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
26076 26077 26078 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26076 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
26055 26056 26057 26058 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26055 def UnitOfTime.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) UnitOfTime.ALL.find { |v| v.value == value } end |
.hour ⇒ Object
26080 26081 26082 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26080 def UnitOfTime.hour @@_hour ||= UnitOfTime.new('hour') end |
.minute ⇒ Object
26084 26085 26086 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26084 def UnitOfTime.minute @@_minute ||= UnitOfTime.new('minute') end |
.month ⇒ Object
26068 26069 26070 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26068 def UnitOfTime.month @@_month ||= UnitOfTime.new('month') end |
.week ⇒ Object
26072 26073 26074 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26072 def UnitOfTime.week @@_week ||= UnitOfTime.new('week') end |
.year ⇒ Object
26064 26065 26066 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26064 def UnitOfTime.year @@_year ||= UnitOfTime.new('year') end |
Instance Method Details
#to_hash ⇒ Object
26088 26089 26090 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26088 def to_hash value end |