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.
-
#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.
40951 40952 40953 40954 40955 40956 40957 40958 40959 40960 40961 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40951 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :direction, :effective_at, :origination_zones, :service], 'Ratecard') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), 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)) @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String)) @published_at = (x = opts.delete(:published_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('published_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime)) end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def effective_at @effective_at end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def id @id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def origination_zones @origination_zones end |
#published_at ⇒ Object (readonly)
Returns the value of attribute published_at.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def published_at @published_at end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
40949 40950 40951 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40949 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
40967 40968 40969 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40967 def copy(incoming={}) Ratecard.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
40971 40972 40973 40974 40975 40976 40977 40978 40979 40980 40981 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40971 def to_hash { :id => id, :direction => direction.value, :effective_at => effective_at, :origination_zones => origination_zones.map { |o| o.to_hash }, :service => service.to_hash, :number => number, :published_at => published_at } end |
#to_json ⇒ Object
40963 40964 40965 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 40963 def to_json JSON.dump(to_hash) end |