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.
46151 46152 46153 46154 46155 46156 46157 46158 46159 46160 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46151 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.
46149 46150 46151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46149 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
46149 46150 46151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46149 def effective_at @effective_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
46149 46150 46151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46149 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
46149 46150 46151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46149 def origination_zones @origination_zones end |
#ratecard_owner ⇒ Object (readonly)
Returns the value of attribute ratecard_owner.
46149 46150 46151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46149 def ratecard_owner @ratecard_owner end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
46149 46150 46151 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46149 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
46166 46167 46168 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46166 def copy(incoming={}) RatecardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
46170 46171 46172 46173 46174 46175 46176 46177 46178 46179 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46170 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
46162 46163 46164 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 46162 def to_json JSON.dump(to_hash) end |