Class: Io::Flow::V0::Models::FuelSurchargeServiceFee

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 = {}) ⇒ FuelSurchargeServiceFee

Returns a new instance of FuelSurchargeServiceFee.



32734
32735
32736
32737
32738
32739
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32734

def initialize(incoming={})
  super(:discriminator => ServiceFee::Types::FUEL_SURCHARGE_SERVICE_FEE)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:percent], 'FuelSurchargeServiceFee')
  @percent = HttpClient::Preconditions.assert_class('percent', HttpClient::Helper.to_big_decimal(opts.delete(:percent)), BigDecimal)
end

Instance Attribute Details

#percentObject (readonly)

Returns the value of attribute percent.



32732
32733
32734
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32732

def percent
  @percent
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



32745
32746
32747
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32745

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

#subtype_to_hashObject



32749
32750
32751
32752
32753
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32749

def subtype_to_hash
  {
    :percent => percent.to_f.to_s
  }
end

#to_jsonObject



32741
32742
32743
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 32741

def to_json
  JSON.dump(to_hash)
end