Class: Io::Flow::V0::Models::SinglePackageShippingNotificationForm

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

Overview

Simplified form for notifying Flow of a Fulfillment shipped entirely in a single tracked package.

Instance Attribute Summary collapse

Attributes inherited from ShippingNotificationForm

#discriminator

Instance Method Summary collapse

Methods inherited from ShippingNotificationForm

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ SinglePackageShippingNotificationForm

Returns a new instance of SinglePackageShippingNotificationForm.



68523
68524
68525
68526
68527
68528
68529
68530
68531
68532
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68523

def initialize(incoming={})
  super(:discriminator => ShippingNotificationForm::Types::SINGLE_PACKAGE_SHIPPING_NOTIFICATION_FORM)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:fulfillment_key, :carrier_tracking_number], 'SinglePackageShippingNotificationForm')
  @fulfillment_key = HttpClient::Preconditions.assert_class('fulfillment_key', opts.delete(:fulfillment_key), String)
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @package_dimensions = (x = opts.delete(:package_dimensions); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::Dimension) ? x : ::Io::Flow::V0::Models::Dimension.new(x)))
  @service = (x = opts.delete(:service); x.nil? ? nil : HttpClient::Preconditions.assert_class('service', x, String))
  @shipment_recipient = (x = opts.delete(:shipment_recipient); x.nil? ? nil : (x = x; x.is_a?(::Io::Flow::V0::Models::ShipmentRecipient) ? x : ::Io::Flow::V0::Models::ShipmentRecipient.apply(x)))
end

Instance Attribute Details

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



68521
68522
68523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68521

def carrier_tracking_number
  @carrier_tracking_number
end

#fulfillment_keyObject (readonly)

Returns the value of attribute fulfillment_key.



68521
68522
68523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68521

def fulfillment_key
  @fulfillment_key
end

#package_dimensionsObject (readonly)

Returns the value of attribute package_dimensions.



68521
68522
68523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68521

def package_dimensions
  @package_dimensions
end

#serviceObject (readonly)

Returns the value of attribute service.



68521
68522
68523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68521

def service
  @service
end

#shipment_recipientObject (readonly)

Returns the value of attribute shipment_recipient.



68521
68522
68523
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68521

def shipment_recipient
  @shipment_recipient
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



68538
68539
68540
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68538

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

#subtype_to_hashObject



68542
68543
68544
68545
68546
68547
68548
68549
68550
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68542

def subtype_to_hash
  {
    :fulfillment_key => fulfillment_key,
    :carrier_tracking_number => carrier_tracking_number,
    :package_dimensions => package_dimensions.nil? ? nil : package_dimensions.to_hash,
    :service => service,
    :shipment_recipient => shipment_recipient.nil? ? nil : shipment_recipient.value
  }
end

#to_jsonObject



68534
68535
68536
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 68534

def to_json
  JSON.dump(to_hash)
end