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.
46892 46893 46894 46895 46896 46897 46898 46899 46900 46901 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46892 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.
46890 46891 46892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46890 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
46890 46891 46892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46890 def effective_at @effective_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
46890 46891 46892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46890 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
46890 46891 46892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46890 def origination_zones @origination_zones end |
#ratecard_owner ⇒ Object (readonly)
Returns the value of attribute ratecard_owner.
46890 46891 46892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46890 def ratecard_owner @ratecard_owner end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
46890 46891 46892 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46890 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
46907 46908 46909 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46907 def copy(incoming={}) RatecardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
46911 46912 46913 46914 46915 46916 46917 46918 46919 46920 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46911 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
46903 46904 46905 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46903 def to_json JSON.dump(to_hash) end |