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.



63525
63526
63527
63528
63529
63530
63531
63532
63533
63534
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63525

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.



63523
63524
63525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63523

def carrier_tracking_number
  @carrier_tracking_number
end

#fulfillment_keyObject (readonly)

Returns the value of attribute fulfillment_key.



63523
63524
63525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63523

def fulfillment_key
  @fulfillment_key
end

#package_dimensionsObject (readonly)

Returns the value of attribute package_dimensions.



63523
63524
63525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63523

def package_dimensions
  @package_dimensions
end

#serviceObject (readonly)

Returns the value of attribute service.



63523
63524
63525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63523

def service
  @service
end

#shipment_recipientObject (readonly)

Returns the value of attribute shipment_recipient.



63523
63524
63525
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63523

def shipment_recipient
  @shipment_recipient
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



63540
63541
63542
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63540

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

#subtype_to_hashObject



63544
63545
63546
63547
63548
63549
63550
63551
63552
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63544

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



63536
63537
63538
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 63536

def to_json
  JSON.dump(to_hash)
end