Class: Io::Flow::V0::Models::NotificationDeleted

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

Instance Attribute Summary collapse

Attributes inherited from Event

#discriminator

Instance Method Summary collapse

Methods inherited from Event

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ NotificationDeleted

Returns a new instance of NotificationDeleted.



24135
24136
24137
24138
24139
24140
24141
24142
24143
24144
24145
24146
24147
24148
24149
24150
24151
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24135

def initialize(incoming={})
  super(:discriminator => Event::Types::NOTIFICATION_DELETED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:event_id, :timestamp, :organization, :notification_id, :carrier_tracking_number, :flow_tracking_number, :destination, :origin, :carrier, :service, :order, :package], 'NotificationDeleted')
  @event_id = HttpClient::Preconditions.assert_class('event_id', opts.delete(:event_id), String)
  @timestamp = HttpClient::Preconditions.assert_class('timestamp', HttpClient::Helper.to_date_time_iso8601(opts.delete(:timestamp)), DateTime)
  @organization = HttpClient::Preconditions.assert_class('organization', opts.delete(:organization), String)
  @notification_id = HttpClient::Preconditions.assert_class('notification_id', opts.delete(:notification_id), String)
  @carrier_tracking_number = HttpClient::Preconditions.assert_class('carrier_tracking_number', opts.delete(:carrier_tracking_number), String)
  @flow_tracking_number = HttpClient::Preconditions.assert_class('flow_tracking_number', opts.delete(:flow_tracking_number), String)
  @destination = (x = opts.delete(:destination); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @origin = (x = opts.delete(:origin); x.is_a?(::Io::Flow::V0::Models::ShippingAddress) ? x : ::Io::Flow::V0::Models::ShippingAddress.new(x))
  @carrier = HttpClient::Preconditions.assert_class('carrier', opts.delete(:carrier), String)
  @service = HttpClient::Preconditions.assert_class('service', opts.delete(:service), String)
  @order = HttpClient::Preconditions.assert_class('order', opts.delete(:order), String)
  @package = (x = opts.delete(:package); x.is_a?(::Io::Flow::V0::Models::ShippingLabelPackage) ? x : ::Io::Flow::V0::Models::ShippingLabelPackage.new(x))
end

Instance Attribute Details

#carrierObject (readonly)

Returns the value of attribute carrier.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def carrier
  @carrier
end

#carrier_tracking_numberObject (readonly)

Returns the value of attribute carrier_tracking_number.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def carrier_tracking_number
  @carrier_tracking_number
end

#destinationObject (readonly)

Returns the value of attribute destination.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def destination
  @destination
end

#event_idObject (readonly)

Returns the value of attribute event_id.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def event_id
  @event_id
end

#flow_tracking_numberObject (readonly)

Returns the value of attribute flow_tracking_number.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def flow_tracking_number
  @flow_tracking_number
end

#notification_idObject (readonly)

Returns the value of attribute notification_id.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def notification_id
  @notification_id
end

#orderObject (readonly)

Returns the value of attribute order.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def order
  @order
end

#organizationObject (readonly)

Returns the value of attribute organization.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def organization
  @organization
end

#originObject (readonly)

Returns the value of attribute origin.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def origin
  @origin
end

#packageObject (readonly)

Returns the value of attribute package.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def package
  @package
end

#serviceObject (readonly)

Returns the value of attribute service.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def service
  @service
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



24133
24134
24135
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24133

def timestamp
  @timestamp
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



24157
24158
24159
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24157

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

#subtype_to_hashObject



24161
24162
24163
24164
24165
24166
24167
24168
24169
24170
24171
24172
24173
24174
24175
24176
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24161

def subtype_to_hash
  {
    :event_id => event_id,
    :timestamp => timestamp,
    :organization => organization,
    :notification_id => notification_id,
    :carrier_tracking_number => carrier_tracking_number,
    :flow_tracking_number => flow_tracking_number,
    :destination => destination.to_hash,
    :origin => origin.to_hash,
    :carrier => carrier,
    :service => service,
    :order => order,
    :package => package.to_hash
  }
end

#to_jsonObject



24153
24154
24155
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 24153

def to_json
  JSON.dump(to_hash)
end