Class: Io::Flow::V0::Models::SyncDuration
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::SyncDuration
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Represents a duration of time with the ability to convert to a scala FiniteDuration.
Instance Attribute Summary collapse
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ SyncDuration
constructor
A new instance of SyncDuration.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ SyncDuration
Returns a new instance of SyncDuration.
52423 52424 52425 52426 52427 52428 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52423 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:unit, :value], 'SyncDuration') @unit = (x = opts.delete(:unit); x.is_a?(::Io::Flow::V0::Models::SyncUnitOfTime) ? x : ::Io::Flow::V0::Models::SyncUnitOfTime.apply(x)) @value = HttpClient::Preconditions.assert_class('value', opts.delete(:value), Integer) end |
Instance Attribute Details
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
52421 52422 52423 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52421 def unit @unit end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
52421 52422 52423 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52421 def value @value end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
52434 52435 52436 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52434 def copy(incoming={}) SyncDuration.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
52438 52439 52440 52441 52442 52443 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52438 def to_hash { :unit => unit.value, :value => value } end |
#to_json ⇒ Object
52430 52431 52432 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 52430 def to_json JSON.dump(to_hash) end |