Class: Io::Flow::V0::Models::Event

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

Direct Known Subclasses

AllocationDeletedV2, AllocationUpsertedV2, AttributeDeleted, AttributeDeletedV2, AttributeUpserted, AttributeUpsertedV2, AuthorizationDeletedV2, AuthorizationStatusChanged, AvailablePromotionsDeleted, AvailablePromotionsDeletedV2, AvailablePromotionsUpserted, AvailablePromotionsUpsertedV2, CaptureDeleted, CaptureIdentifierDeleted, CaptureIdentifierUpserted, CaptureUpsertedV2, CardAuthorizationUpsertedV2, CardDeleted, CardUpsertedV2, CatalogDeleted, CatalogItemDeleted, CatalogItemUpserted, CatalogUpserted, ConsumerInvoiceDeleted, ConsumerInvoiceUpserted, CreditMemoDeleted, CreditMemoUpserted, CrossdockShipmentUpserted, CurrencyFormatDeleted, CurrencyFormatUpserted, DeliveryOptionDeleted, DeliveryOptionUpserted, EventUndefinedType, ExperienceDeleted, ExperienceDeletedV2, ExperienceLogisticsSettingsDeleted, ExperienceLogisticsSettingsUpserted, ExperiencePriceBookMappingDeleted, ExperiencePriceBookMappingUpserted, ExperienceUpserted, ExperienceUpsertedV2, FraudStatusChanged, FullyHarmonizedItemUpserted, HarmonizedItemDeleted, HarmonizedItemUpserted, HarmonizedLandedCostUpserted, Hs10CodeDeleted, Hs10CodeUpserted, Hs6CodeDeleted, Hs6CodeUpserted, ItemMarginDeleted, ItemMarginUpserted, ItemOriginDeleted, ItemOriginUpserted, ItemSalesMarginDeleted, ItemSalesMarginUpserted, LabelFormatDeleted, LabelFormatUpserted, LabelUpserted, LocalItemDeleted, LocalItemUpserted, ManifestedLabelDeleted, ManifestedLabelUpserted, MembershipDeleted, MembershipDeletedV2, MembershipUpserted, MembershipUpsertedV2, NotificationDeleted, NotificationUpserted, OnlineAuthorizationUpsertedV2, OrderDeleted, OrderDeletedV2, OrderIdentifierDeleted, OrderIdentifierDeletedV2, OrderIdentifierUpserted, OrderIdentifierUpsertedV2, OrderUpserted, OrderUpsertedV2, OrganizationCountriesPublished, OrganizationDeleted, OrganizationDeletedV2, OrganizationRatecardTransitWindowsPublished, OrganizationRatesPublished, OrganizationShortIdDeleted, OrganizationShortIdUpserted, OrganizationUpserted, OrganizationUpsertedV2, PaymentDeleted, PaymentUpserted, PriceBookDeleted, PriceBookItemDeleted, PriceBookItemUpserted, PriceBookUpserted, PricingDeleted, PricingUpserted, RateDeleted, RateUpserted, RefundCaptureUpsertedV2, RefundIdentifierDeleted, RefundIdentifierUpserted, RefundUpsertedV2, ReturnDeleted, ReturnUpserted, ReversalDeleted, ReversalUpserted, RuleDeleted, RuleUpserted, SerialDeleted, SerialUpserted, ShippingConfigurationDeleted, ShippingConfigurationUpserted, ShippingLaneDeleted, ShippingLaneUpserted, SnapshotDeleted, SnapshotUpserted, SubcatalogDeleted, SubcatalogItemDeleted, SubcatalogItemUpserted, SubcatalogUpserted, TargetingItemDeleted, TargetingItemDeletedV2, TargetingItemUpserted, TierDeleted, TierDeletedV2, TierUpserted, TierUpsertedV2, TrackingLabelEventUpserted, VirtualCardCaptureDeleted, VirtualCardCaptureUpserted, VirtualCardRefundDeleted, VirtualCardRefundUpserted

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ Event

Returns a new instance of Event.



6935
6936
6937
6938
6939
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6935

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

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



6933
6934
6935
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6933

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



6949
6950
6951
6952
6953
6954
6955
6956
6957
6958
6959
6960
6961
6962
6963
6964
6965
6966
6967
6968
6969
6970
6971
6972
6973
6974
6975
6976
6977
6978
6979
6980
6981
6982
6983
6984
6985
6986
6987
6988
6989
6990
6991
6992
6993
6994
6995
6996
6997
6998
6999
7000
7001
7002
7003
7004
7005
7006
7007
7008
7009
7010
7011
7012
7013
7014
7015
7016
7017
7018
7019
7020
7021
7022
7023
7024
7025
7026
7027
7028
7029
7030
7031
7032
7033
7034
7035
7036
7037
7038
7039
7040
7041
7042
7043
7044
7045
7046
7047
7048
7049
7050
7051
7052
7053
7054
7055
7056
7057
7058
7059
7060
7061
7062
7063
7064
7065
7066
7067
7068
7069
7070
7071
7072
7073
7074
7075
7076
7077
7078
7079
7080
7081
7082
7083
7084
7085
7086
7087
7088
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6949

def Event.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[event] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::ATTRIBUTE_UPSERTED; AttributeUpserted.new(hash)
    when Types::ATTRIBUTE_DELETED; AttributeDeleted.new(hash)
    when Types::ATTRIBUTE_UPSERTED_V2; AttributeUpsertedV2.new(hash)
    when Types::ATTRIBUTE_DELETED_V2; AttributeDeletedV2.new(hash)
    when Types::CATALOG_UPSERTED; CatalogUpserted.new(hash)
    when Types::CATALOG_DELETED; CatalogDeleted.new(hash)
    when Types::SUBCATALOG_UPSERTED; SubcatalogUpserted.new(hash)
    when Types::SUBCATALOG_DELETED; SubcatalogDeleted.new(hash)
    when Types::CATALOG_ITEM_UPSERTED; CatalogItemUpserted.new(hash)
    when Types::CATALOG_ITEM_DELETED; CatalogItemDeleted.new(hash)
    when Types::SUBCATALOG_ITEM_UPSERTED; SubcatalogItemUpserted.new(hash)
    when Types::SUBCATALOG_ITEM_DELETED; SubcatalogItemDeleted.new(hash)
    when Types::CONSUMER_INVOICE_UPSERTED; ConsumerInvoiceUpserted.new(hash)
    when Types::CONSUMER_INVOICE_DELETED; ConsumerInvoiceDeleted.new(hash)
    when Types::CREDIT_MEMO_UPSERTED; CreditMemoUpserted.new(hash)
    when Types::CREDIT_MEMO_DELETED; CreditMemoDeleted.new(hash)
    when Types::CROSSDOCK_SHIPMENT_UPSERTED; CrossdockShipmentUpserted.new(hash)
    when Types::RATE_DELETED; RateDeleted.new(hash)
    when Types::RATE_UPSERTED; RateUpserted.new(hash)
    when Types::AVAILABLE_PROMOTIONS_UPSERTED; AvailablePromotionsUpserted.new(hash)
    when Types::AVAILABLE_PROMOTIONS_DELETED; AvailablePromotionsDeleted.new(hash)
    when Types::AVAILABLE_PROMOTIONS_UPSERTED_V2; AvailablePromotionsUpsertedV2.new(hash)
    when Types::AVAILABLE_PROMOTIONS_DELETED_V2; AvailablePromotionsDeletedV2.new(hash)
    when Types::ALLOCATION_DELETED_V2; AllocationDeletedV2.new(hash)
    when Types::ALLOCATION_UPSERTED_V2; AllocationUpsertedV2.new(hash)
    when Types::CURRENCY_FORMAT_DELETED; CurrencyFormatDeleted.new(hash)
    when Types::CURRENCY_FORMAT_UPSERTED; CurrencyFormatUpserted.new(hash)
    when Types::EXPERIENCE_DELETED; ExperienceDeleted.new(hash)
    when Types::EXPERIENCE_UPSERTED; ExperienceUpserted.new(hash)
    when Types::EXPERIENCE_DELETED_V2; ExperienceDeletedV2.new(hash)
    when Types::EXPERIENCE_UPSERTED_V2; ExperienceUpsertedV2.new(hash)
    when Types::EXPERIENCE_PRICE_BOOK_MAPPING_DELETED; ExperiencePriceBookMappingDeleted.new(hash)
    when Types::EXPERIENCE_PRICE_BOOK_MAPPING_UPSERTED; ExperiencePriceBookMappingUpserted.new(hash)
    when Types::EXPERIENCE_LOGISTICS_SETTINGS_UPSERTED; ExperienceLogisticsSettingsUpserted.new(hash)
    when Types::EXPERIENCE_LOGISTICS_SETTINGS_DELETED; ExperienceLogisticsSettingsDeleted.new(hash)
    when Types::ITEM_MARGIN_DELETED; ItemMarginDeleted.new(hash)
    when Types::ITEM_MARGIN_UPSERTED; ItemMarginUpserted.new(hash)
    when Types::ITEM_SALES_MARGIN_DELETED; ItemSalesMarginDeleted.new(hash)
    when Types::ITEM_SALES_MARGIN_UPSERTED; ItemSalesMarginUpserted.new(hash)
    when Types::LABEL_FORMAT_DELETED; LabelFormatDeleted.new(hash)
    when Types::LABEL_FORMAT_UPSERTED; LabelFormatUpserted.new(hash)
    when Types::ORDER_DELETED; OrderDeleted.new(hash)
    when Types::ORDER_UPSERTED; OrderUpserted.new(hash)
    when Types::ORDER_DELETED_V2; OrderDeletedV2.new(hash)
    when Types::ORDER_UPSERTED_V2; OrderUpsertedV2.new(hash)
    when Types::ORDER_IDENTIFIER_DELETED; OrderIdentifierDeleted.new(hash)
    when Types::ORDER_IDENTIFIER_UPSERTED; OrderIdentifierUpserted.new(hash)
    when Types::ORDER_IDENTIFIER_DELETED_V2; OrderIdentifierDeletedV2.new(hash)
    when Types::ORDER_IDENTIFIER_UPSERTED_V2; OrderIdentifierUpsertedV2.new(hash)
    when Types::PRICING_DELETED; PricingDeleted.new(hash)
    when Types::PRICING_UPSERTED; PricingUpserted.new(hash)
    when Types::FRAUD_STATUS_CHANGED; FraudStatusChanged.new(hash)
    when Types::TIER_UPSERTED; TierUpserted.new(hash)
    when Types::TIER_DELETED; TierDeleted.new(hash)
    when Types::DELIVERY_OPTION_UPSERTED; DeliveryOptionUpserted.new(hash)
    when Types::DELIVERY_OPTION_DELETED; DeliveryOptionDeleted.new(hash)
    when Types::SHIPPING_CONFIGURATION_UPSERTED; ShippingConfigurationUpserted.new(hash)
    when Types::SHIPPING_CONFIGURATION_DELETED; ShippingConfigurationDeleted.new(hash)
    when Types::TIER_UPSERTED_V2; TierUpsertedV2.new(hash)
    when Types::TIER_DELETED_V2; TierDeletedV2.new(hash)
    when Types::SHIPPING_LANE_UPSERTED; ShippingLaneUpserted.new(hash)
    when Types::SHIPPING_LANE_DELETED; ShippingLaneDeleted.new(hash)
    when Types::HS6_CODE_UPSERTED; Hs6CodeUpserted.new(hash)
    when Types::HS6_CODE_DELETED; Hs6CodeDeleted.new(hash)
    when Types::HS10_CODE_UPSERTED; Hs10CodeUpserted.new(hash)
    when Types::HS10_CODE_DELETED; Hs10CodeDeleted.new(hash)
    when Types::ITEM_ORIGIN_UPSERTED; ItemOriginUpserted.new(hash)
    when Types::ITEM_ORIGIN_DELETED; ItemOriginDeleted.new(hash)
    when Types::HARMONIZED_ITEM_UPSERTED; HarmonizedItemUpserted.new(hash)
    when Types::HARMONIZED_ITEM_DELETED; HarmonizedItemDeleted.new(hash)
    when Types::HARMONIZED_LANDED_COST_UPSERTED; HarmonizedLandedCostUpserted.new(hash)
    when Types::FULLY_HARMONIZED_ITEM_UPSERTED; FullyHarmonizedItemUpserted.new(hash)
    when Types::RULE_UPSERTED; RuleUpserted.new(hash)
    when Types::RULE_DELETED; RuleDeleted.new(hash)
    when Types::SERIAL_UPSERTED; SerialUpserted.new(hash)
    when Types::SERIAL_DELETED; SerialDeleted.new(hash)
    when Types::SNAPSHOT_UPSERTED; SnapshotUpserted.new(hash)
    when Types::SNAPSHOT_DELETED; SnapshotDeleted.new(hash)
    when Types::LABEL_UPSERTED; LabelUpserted.new(hash)
    when Types::NOTIFICATION_UPSERTED; NotificationUpserted.new(hash)
    when Types::NOTIFICATION_DELETED; NotificationDeleted.new(hash)
    when Types::MANIFESTED_LABEL_UPSERTED; ManifestedLabelUpserted.new(hash)
    when Types::MANIFESTED_LABEL_DELETED; ManifestedLabelDeleted.new(hash)
    when Types::LOCAL_ITEM_UPSERTED; LocalItemUpserted.new(hash)
    when Types::LOCAL_ITEM_DELETED; LocalItemDeleted.new(hash)
    when Types::MEMBERSHIP_UPSERTED; MembershipUpserted.new(hash)
    when Types::MEMBERSHIP_DELETED; MembershipDeleted.new(hash)
    when Types::MEMBERSHIP_UPSERTED_V2; MembershipUpsertedV2.new(hash)
    when Types::MEMBERSHIP_DELETED_V2; MembershipDeletedV2.new(hash)
    when Types::ORGANIZATION_UPSERTED; OrganizationUpserted.new(hash)
    when Types::ORGANIZATION_DELETED; OrganizationDeleted.new(hash)
    when Types::ORGANIZATION_UPSERTED_V2; OrganizationUpsertedV2.new(hash)
    when Types::ORGANIZATION_DELETED_V2; OrganizationDeletedV2.new(hash)
    when Types::ORGANIZATION_SHORT_ID_UPSERTED; OrganizationShortIdUpserted.new(hash)
    when Types::ORGANIZATION_SHORT_ID_DELETED; OrganizationShortIdDeleted.new(hash)
    when Types::AUTHORIZATION_DELETED_V2; AuthorizationDeletedV2.new(hash)
    when Types::AUTHORIZATION_STATUS_CHANGED; AuthorizationStatusChanged.new(hash)
    when Types::CARD_AUTHORIZATION_UPSERTED_V2; CardAuthorizationUpsertedV2.new(hash)
    when Types::ONLINE_AUTHORIZATION_UPSERTED_V2; OnlineAuthorizationUpsertedV2.new(hash)
    when Types::CAPTURE_UPSERTED_V2; CaptureUpsertedV2.new(hash)
    when Types::CAPTURE_DELETED; CaptureDeleted.new(hash)
    when Types::CARD_UPSERTED_V2; CardUpsertedV2.new(hash)
    when Types::CARD_DELETED; CardDeleted.new(hash)
    when Types::PAYMENT_UPSERTED; PaymentUpserted.new(hash)
    when Types::PAYMENT_DELETED; PaymentDeleted.new(hash)
    when Types::REFUND_UPSERTED_V2; RefundUpsertedV2.new(hash)
    when Types::REFUND_CAPTURE_UPSERTED_V2; RefundCaptureUpsertedV2.new(hash)
    when Types::REVERSAL_UPSERTED; ReversalUpserted.new(hash)
    when Types::REVERSAL_DELETED; ReversalDeleted.new(hash)
    when Types::CAPTURE_IDENTIFIER_UPSERTED; CaptureIdentifierUpserted.new(hash)
    when Types::CAPTURE_IDENTIFIER_DELETED; CaptureIdentifierDeleted.new(hash)
    when Types::REFUND_IDENTIFIER_UPSERTED; RefundIdentifierUpserted.new(hash)
    when Types::REFUND_IDENTIFIER_DELETED; RefundIdentifierDeleted.new(hash)
    when Types::VIRTUAL_CARD_CAPTURE_UPSERTED; VirtualCardCaptureUpserted.new(hash)
    when Types::VIRTUAL_CARD_CAPTURE_DELETED; VirtualCardCaptureDeleted.new(hash)
    when Types::VIRTUAL_CARD_REFUND_UPSERTED; VirtualCardRefundUpserted.new(hash)
    when Types::VIRTUAL_CARD_REFUND_DELETED; VirtualCardRefundDeleted.new(hash)
    when Types::PRICE_BOOK_UPSERTED; PriceBookUpserted.new(hash)
    when Types::PRICE_BOOK_DELETED; PriceBookDeleted.new(hash)
    when Types::PRICE_BOOK_ITEM_UPSERTED; PriceBookItemUpserted.new(hash)
    when Types::PRICE_BOOK_ITEM_DELETED; PriceBookItemDeleted.new(hash)
    when Types::ORGANIZATION_RATES_PUBLISHED; OrganizationRatesPublished.new(hash)
    when Types::ORGANIZATION_COUNTRIES_PUBLISHED; OrganizationCountriesPublished.new(hash)
    when Types::ORGANIZATION_RATECARD_TRANSIT_WINDOWS_PUBLISHED; OrganizationRatecardTransitWindowsPublished.new(hash)
    when Types::RETURN_UPSERTED; ReturnUpserted.new(hash)
    when Types::RETURN_DELETED; ReturnDeleted.new(hash)
    when Types::TARGETING_ITEM_UPSERTED; TargetingItemUpserted.new(hash)
    when Types::TARGETING_ITEM_DELETED; TargetingItemDeleted.new(hash)
    when Types::TARGETING_ITEM_DELETED_V2; TargetingItemDeletedV2.new(hash)
    when Types::TRACKING_LABEL_EVENT_UPSERTED; TrackingLabelEventUpserted.new(hash)
    else EventUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



6941
6942
6943
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6941

def subtype_to_hash
  raise 'Cannot serialize an instance of event directly - must use one of the specific types: attribute_upserted, attribute_deleted, attribute_upserted_v2, attribute_deleted_v2, catalog_upserted, catalog_deleted, subcatalog_upserted, subcatalog_deleted, catalog_item_upserted, catalog_item_deleted, subcatalog_item_upserted, subcatalog_item_deleted, consumer_invoice_upserted, consumer_invoice_deleted, credit_memo_upserted, credit_memo_deleted, crossdock_shipment_upserted, rate_deleted, rate_upserted, available_promotions_upserted, available_promotions_deleted, available_promotions_upserted_v2, available_promotions_deleted_v2, allocation_deleted_v2, allocation_upserted_v2, currency_format_deleted, currency_format_upserted, experience_deleted, experience_upserted, experience_deleted_v2, experience_upserted_v2, experience_price_book_mapping_deleted, experience_price_book_mapping_upserted, experience_logistics_settings_upserted, experience_logistics_settings_deleted, item_margin_deleted, item_margin_upserted, item_sales_margin_deleted, item_sales_margin_upserted, label_format_deleted, label_format_upserted, order_deleted, order_upserted, order_deleted_v2, order_upserted_v2, order_identifier_deleted, order_identifier_upserted, order_identifier_deleted_v2, order_identifier_upserted_v2, pricing_deleted, pricing_upserted, fraud_status_changed, tier_upserted, tier_deleted, delivery_option_upserted, delivery_option_deleted, shipping_configuration_upserted, shipping_configuration_deleted, tier_upserted_v2, tier_deleted_v2, shipping_lane_upserted, shipping_lane_deleted, hs6_code_upserted, hs6_code_deleted, hs10_code_upserted, hs10_code_deleted, item_origin_upserted, item_origin_deleted, harmonized_item_upserted, harmonized_item_deleted, harmonized_landed_cost_upserted, fully_harmonized_item_upserted, rule_upserted, rule_deleted, serial_upserted, serial_deleted, snapshot_upserted, snapshot_deleted, label_upserted, notification_upserted, notification_deleted, manifested_label_upserted, manifested_label_deleted, local_item_upserted, local_item_deleted, membership_upserted, membership_deleted, membership_upserted_v2, membership_deleted_v2, organization_upserted, organization_deleted, organization_upserted_v2, organization_deleted_v2, organization_short_id_upserted, organization_short_id_deleted, authorization_deleted_v2, authorization_status_changed, card_authorization_upserted_v2, online_authorization_upserted_v2, capture_upserted_v2, capture_deleted, card_upserted_v2, card_deleted, payment_upserted, payment_deleted, refund_upserted_v2, refund_capture_upserted_v2, reversal_upserted, reversal_deleted, capture_identifier_upserted, capture_identifier_deleted, refund_identifier_upserted, refund_identifier_deleted, virtual_card_capture_upserted, virtual_card_capture_deleted, virtual_card_refund_upserted, virtual_card_refund_deleted, price_book_upserted, price_book_deleted, price_book_item_upserted, price_book_item_deleted, organization_rates_published, organization_countries_published, organization_ratecard_transit_windows_published, return_upserted, return_deleted, targeting_item_upserted, targeting_item_deleted, targeting_item_deleted_v2, tracking_label_event_upserted'
end

#to_hashObject



6945
6946
6947
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6945

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