Class: Io::Flow::V0::Models::RatecardForm
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::RatecardForm
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Instance Attribute Summary collapse
-
#direction ⇒ Object
readonly
Returns the value of attribute direction.
-
#effective_at ⇒ Object
readonly
Returns the value of attribute effective_at.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#origination_zones ⇒ Object
readonly
Returns the value of attribute origination_zones.
-
#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 = {}) ⇒ RatecardForm
constructor
A new instance of RatecardForm.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ RatecardForm
43632 43633 43634 43635 43636 43637 43638 43639 43640 43641 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43632 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:direction, :effective_at, :origination_zones, :service], 'RatecardForm') @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 = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String) @number = (x = opts.delete(:number); x.nil? ? nil : HttpClient::Preconditions.assert_class('number', x, String)) @ratecard_owner = (x = (x = opts.delete(:ratecard_owner); x.nil? ? "flow" : x); 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.
43630 43631 43632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43630 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
43630 43631 43632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43630 def effective_at @effective_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
43630 43631 43632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43630 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
43630 43631 43632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43630 def origination_zones @origination_zones end |
#ratecard_owner ⇒ Object (readonly)
Returns the value of attribute ratecard_owner.
43630 43631 43632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43630 def ratecard_owner @ratecard_owner end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
43630 43631 43632 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43630 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
43647 43648 43649 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43647 def copy(incoming={}) RatecardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
43651 43652 43653 43654 43655 43656 43657 43658 43659 43660 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43651 def to_hash { :direction => direction.value, :effective_at => effective_at, :origination_zones => origination_zones.map { |o| o.to_hash }, :service => service, :number => number, :ratecard_owner => ratecard_owner.value } end |
#to_json ⇒ Object
43643 43644 43645 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 43643 def to_json JSON.dump(to_hash) end |