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
Returns a new instance of RatecardForm.
46304 46305 46306 46307 46308 46309 46310 46311 46312 46313 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46304 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.
46302 46303 46304 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46302 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
46302 46303 46304 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46302 def effective_at @effective_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
46302 46303 46304 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46302 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
46302 46303 46304 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46302 def origination_zones @origination_zones end |
#ratecard_owner ⇒ Object (readonly)
Returns the value of attribute ratecard_owner.
46302 46303 46304 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46302 def ratecard_owner @ratecard_owner end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
46302 46303 46304 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46302 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
46319 46320 46321 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46319 def copy(incoming={}) RatecardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
46323 46324 46325 46326 46327 46328 46329 46330 46331 46332 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46323 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
46315 46316 46317 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46315 def to_json JSON.dump(to_hash) end |