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.
6904 6905 6906 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6904 def initialize(value) @value = HttpClient::Preconditions.assert_class('value', value, String) end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
6902 6903 6904 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6902 def value @value end |
Class Method Details
.ALL ⇒ Object
6924 6925 6926 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6924 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
6909 6910 6911 6912 6913 6914 6915 6916 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6909 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
6928 6929 6930 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6928 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
6919 6920 6921 6922 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6919 def UnitOfTime.from_string(value) HttpClient::Preconditions.assert_class('value', value, String) UnitOfTime.ALL.find { |v| v.value == value } end |
.hour ⇒ Object
6932 6933 6934 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6932 def UnitOfTime.hour @@_hour ||= UnitOfTime.new('hour') end |
.minute ⇒ Object
6936 6937 6938 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6936 def UnitOfTime.minute @@_minute ||= UnitOfTime.new('minute') end |
Instance Method Details
#to_hash ⇒ Object
6940 6941 6942 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6940 def to_hash value end |