Class: Io::Flow::V0::Models::PeakSurchargeServiceFee

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

Instance Attribute Summary collapse

Attributes inherited from ServiceFee

#discriminator

Instance Method Summary collapse

Methods inherited from ServiceFee

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ PeakSurchargeServiceFee

Returns a new instance of PeakSurchargeServiceFee.



59496
59497
59498
59499
59500
59501
59502
59503
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59496

def initialize(incoming={})
  super(:discriminator => ServiceFee::Types::PEAK_SURCHARGE_SERVICE_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:amount], 'PeakSurchargeServiceFee')
  @amount = (x = opts.delete(:amount); x.is_a?(::Io::Flow::V0::Models::Money) ? x : ::Io::Flow::V0::Models::Money.new(x))
  @starts_at = (x = opts.delete(:starts_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('starts_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
  @ends_at = (x = opts.delete(:ends_at); x.nil? ? nil : HttpClient::Preconditions.assert_class('ends_at', HttpClient::Helper.to_date_time_iso8601(x), DateTime))
end

Instance Attribute Details

#amountObject (readonly)

Returns the value of attribute amount.



59494
59495
59496
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59494

def amount
  @amount
end

#ends_atObject (readonly)

Returns the value of attribute ends_at.



59494
59495
59496
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59494

def ends_at
  @ends_at
end

#starts_atObject (readonly)

Returns the value of attribute starts_at.



59494
59495
59496
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59494

def starts_at
  @starts_at
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



59509
59510
59511
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59509

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

#subtype_to_hashObject



59513
59514
59515
59516
59517
59518
59519
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59513

def subtype_to_hash
  {
    :amount => amount.to_hash,
    :starts_at => starts_at,
    :ends_at => ends_at
  }
end

#to_jsonObject



59505
59506
59507
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 59505

def to_json
  JSON.dump(to_hash)
end