Class: Io::Flow::V0::Models::Ratecard
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Ratecard
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Snapshot of all lanes and rows across all service levels of an organization
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#effective_at ⇒ Object
readonly
Returns the value of attribute effective_at.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#origination_zones ⇒ Object
readonly
Returns the value of attribute origination_zones.
-
#published_at ⇒ Object
readonly
Returns the value of attribute published_at.
-
#ratecard_owner ⇒ Object
readonly
Returns the value of attribute ratecard_owner.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Ratecard
constructor
A new instance of Ratecard.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Ratecard
Returns a new instance of Ratecard.
57111 57112 57113 57114 57115 57116 57117 57118 57119 57120 57121 57122 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57111 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :number, :direction, :effective_at, :origination_zones, :service, :ratecard_owner], 'Ratecard') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @number = HttpClient::Preconditions.assert_class('number', opts.delete(:number), String) @direction = (x = opts.delete(:direction); x.is_a?(::Io::Flow::V0::Models::Direction) ? x : ::Io::Flow::V0::Models::Direction.apply(x)) @effective_at = HttpClient::Preconditions.assert_class('effective_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:effective_at)), DateTime) @origination_zones = HttpClient::Preconditions.assert_class('origination_zones', opts.delete(:origination_zones), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::Zone) ? x : ::Io::Flow::V0::Models::Zone.new(x)) } @service = (x = opts.delete(:service); x.is_a?(::Io::Flow::V0::Models::RatecardServiceSummary) ? x : ::Io::Flow::V0::Models::RatecardServiceSummary.new(x)) @published_at = (x = opts.delete(:published_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('published_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) @ratecard_owner = (x = opts.delete(:ratecard_owner); x.is_a?(::Io::Flow::V0::Models::RatecardOwner) ? x : ::Io::Flow::V0::Models::RatecardOwner.apply(x)) end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def effective_at @effective_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def id @id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def origination_zones @origination_zones end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def published_at @published_at end |
#ratecard_owner ⇒ Object (readonly)
Returns the value of attribute ratecard_owner.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def ratecard_owner @ratecard_owner end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
57109 57110 57111 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57109 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
57128 57129 57130 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57128 def copy(incoming={}) Ratecard.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
57132 57133 57134 57135 57136 57137 57138 57139 57140 57141 57142 57143 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57132 def to_hash { :id => id, :number => number, :direction => direction.value, :effective_at => effective_at, :origination_zones => origination_zones.map { |o| o.to_hash }, :service => service.to_hash, :published_at => published_at, :ratecard_owner => ratecard_owner.value } end |
#to_json ⇒ Object
57124 57125 57126 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 57124 def to_json JSON.dump(to_hash) end |