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.
-
#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.
41227 41228 41229 41230 41231 41232 41233 41234 41235 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41227 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)) end |
Instance Attribute Details
#direction ⇒ Object (readonly)
Returns the value of attribute direction.
41225 41226 41227 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41225 def direction @direction end |
#effective_at ⇒ Object (readonly)
Returns the value of attribute effective_at.
41225 41226 41227 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41225 def effective_at @effective_at end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
41225 41226 41227 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41225 def number @number end |
#origination_zones ⇒ Object (readonly)
Returns the value of attribute origination_zones.
41225 41226 41227 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41225 def origination_zones @origination_zones end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
41225 41226 41227 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41225 def service @service end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
41241 41242 41243 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41241 def copy(incoming={}) RatecardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
41245 41246 41247 41248 41249 41250 41251 41252 41253 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41245 def to_hash { :direction => direction.value, :effective_at => effective_at, :origination_zones => origination_zones.map { |o| o.to_hash }, :service => service, :number => number } end |
#to_json ⇒ Object
41237 41238 41239 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 41237 def to_json JSON.dump(to_hash) end |