Class: Io::Flow::V0::Models::RatecardForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ RatecardForm

Returns a new instance of RatecardForm.



62146
62147
62148
62149
62150
62151
62152
62153
62154
62155
# 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

Instance Attribute Details

#directionObject (readonly)

Returns the value of attribute direction.



62144
62145
62146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62144

def direction
  @direction
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



62144
62145
62146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62144

def effective_at
  @effective_at
end

#numberObject (readonly)

Returns the value of attribute number.



62144
62145
62146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62144

def number
  @number
end

#origination_zonesObject (readonly)

Returns the value of attribute origination_zones.



62144
62145
62146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62144

def origination_zones
  @origination_zones
end

#ratecard_ownerObject (readonly)

Returns the value of attribute ratecard_owner.



62144
62145
62146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62144

def ratecard_owner
  @ratecard_owner
end

#serviceObject (readonly)

Returns the value of attribute service.



62144
62145
62146
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62144

def service
  @service
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



62161
62162
62163
# 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_hashObject



62165
62166
62167
62168
62169
62170
62171
62172
62173
62174
# 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_jsonObject



62157
62158
62159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 62157

def to_json
  JSON.dump(to_hash)
end