class Io::Flow::V0::Models::RatecardForm

Attributes

direction[R]
effective_at[R]
number[R]
origination_zones[R]
ratecard_owner[R]
service[R]

Public Class Methods

new(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62146
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

Public Instance Methods

copy(incoming={}) click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62161
def copy(incoming={})
  RatecardForm.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end
to_hash() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62165
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() click to toggle source
# File lib/flow_commerce/flow_api_v0_client.rb, line 62157
def to_json
  JSON.dump(to_hash)
end