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
Returns a new instance of UnitOfTime.
28179 28180 28181 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28179 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
28177 28178 28179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28177 def value @value end |
Class Method Details
.ALL ⇒ Object
28199 28200 28201 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28199 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
28184 28185 28186 28187 28188 28189 28190 28191 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28184 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
28215 28216 28217 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28215 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
28194 28195 28196 28197 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28194 def UnitOfTime.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) UnitOfTime.ALL.find { |v| v.value == value } end |
.hour ⇒ Object
28219 28220 28221 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28219 def UnitOfTime.hour @@_hour ||= UnitOfTime.new('hour') end |
.minute ⇒ Object
28223 28224 28225 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28223 def UnitOfTime.minute @@_minute ||= UnitOfTime.new('minute') end |
.month ⇒ Object
28207 28208 28209 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28207 def UnitOfTime.month @@_month ||= UnitOfTime.new('month') end |
.week ⇒ Object
28211 28212 28213 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28211 def UnitOfTime.week @@_week ||= UnitOfTime.new('week') end |
.year ⇒ Object
28203 28204 28205 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28203 def UnitOfTime.year @@_year ||= UnitOfTime.new('year') end |
Instance Method Details
#to_hash ⇒ Object
28227 28228 28229 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 28227 def to_hash value end |