Class: Io::Flow::V0::Models::ContractedRateUpserted

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ ContractedRateUpserted

Returns a new instance of ContractedRateUpserted.



9597
9598
9599
9600
9601
9602
9603
9604
9605
9606
9607
9608
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9597

def initialize(incoming={})
  super(:name => Event::Types::CONTRACTED_RATE_UPSERTED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization_id, :base, :target, :effective_at, :value], 'ContractedRateUpserted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @organization_id = HttpClient::Preconditions.assert_class('organization_id', opts.delete(:organization_id), String)
  @base = HttpClient::Preconditions.assert_class('base', opts.delete(:base), String)
  @target = HttpClient::Preconditions.assert_class('target', opts.delete(:target), String)
  @effective_at = HttpClient::Preconditions.assert_class('effective_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:effective_at)), DateTime)
  @value = HttpClient::Preconditions.assert_class('value', HttpClient::Helper.to_big_decimal(opts.delete(:value)), BigDecimal)
end

Instance Attribute Details

#baseObject (readonly)

Returns the value of attribute base.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def base
  @base
end

#effective_atObject (readonly)

Returns the value of attribute effective_at.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def effective_at
  @effective_at
end

#event_idObject (readonly)

Returns the value of attribute event_id.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def event_id
  @event_id
end

#organization_idObject (readonly)

Returns the value of attribute organization_id.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def organization_id
  @organization_id
end

#targetObject (readonly)

Returns the value of attribute target.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def target
  @target
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def timestamp
  @timestamp
end

#valueObject (readonly)

Returns the value of attribute value.



9595
9596
9597
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9595

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



9614
9615
9616
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9614

def copy(incoming={})
  ContractedRateUpserted.new(subtype_to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#subtype_to_hashObject



9618
9619
9620
9621
9622
9623
9624
9625
9626
9627
9628
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9618

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization_id => organization_id,
    :base => base,
    :target => target,
    :effective_at => effective_at,
    :value => value
  }
end

#to_jsonObject



9610
9611
9612
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9610

def to_json
  JSON.dump(to_hash)
end