Class: Io::Flow::V0::Models::OrderRefundSummaryForm

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

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ OrderRefundSummaryForm

Returns a new instance of OrderRefundSummaryForm.



13372
13373
13374
13375
13376
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13372

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:discriminator], 'OrderRefundSummaryForm')
  @discriminator = HttpClient::Preconditions.assert_class('discriminator', opts.delete(:discriminator), String)
end

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



13370
13371
13372
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13370

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



13386
13387
13388
13389
13390
13391
13392
13393
13394
13395
13396
13397
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13386

def OrderRefundSummaryForm.from_json(hash)
  HttpClient::Preconditions.assert_class('hash', hash, Hash)
  discriminator = HttpClient::Helper.symbolize_keys(hash)[:discriminator].to_s.strip
  if discriminator.empty?
    raise "Union type[order_refund_summary_form] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::ORDER_REFUND_SUMMARY_FULL_FORM; OrderRefundSummaryFullForm.new(hash)
    when Types::ORDER_REFUND_SUMMARY_PARTIAL_FORM; OrderRefundSummaryPartialForm.new(hash)
    else OrderRefundSummaryFormUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



13378
13379
13380
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13378

def subtype_to_hash
  raise 'Cannot serialize an instance of order_refund_summary_form directly - must use one of the specific types: order_refund_summary_full_form, order_refund_summary_partial_form'
end

#to_hashObject



13382
13383
13384
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 13382

def to_hash
  subtype_to_hash.merge(:discriminator => @discriminator)
end