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, AuthorizationDeleted, AuthorizationDeletedV2, AuthorizationStatusChanged, AuthorizationUpserted, AvailablePromotionsDeleted, AvailablePromotionsUpserted, CaptureUpserted, CaptureUpsertedV2, CardAuthorizationUpserted, CardAuthorizationUpsertedV2, CardDeleted, CardUpserted, CardUpsertedV2, CatalogDeleted, CatalogItemDeleted, CatalogItemUpserted, CatalogUpserted, CrossdockShipmentUpserted, CurrencyFormatDeleted, CurrencyFormatUpserted, DeliveryOptionDeleted, DeliveryOptionUpserted, EventUndefinedType, ExperienceDeleted, ExperiencePriceBookMappingDeleted, ExperiencePriceBookMappingUpserted, ExperienceUpserted, FraudStatusChanged, FullyHarmonizedItemUpserted, HarmonizedItemDeleted, HarmonizedItemUpserted, HarmonizedLandedCostUpserted, Hs10CodeDeleted, Hs10CodeUpserted, Hs6CodeDeleted, Hs6CodeUpserted, ItemMarginDeleted, ItemMarginUpserted, ItemOriginDeleted, ItemOriginUpserted, ItemSalesMarginDeleted, ItemSalesMarginUpserted, LabelFormatDeleted, LabelFormatUpserted, LabelUpserted, LocalItemDeleted, LocalItemUpserted, ManifestedLabelDeleted, ManifestedLabelUpserted, MembershipDeleted, MembershipUpserted, NotificationDeleted, NotificationUpserted, OnlineAuthorizationUpserted, OnlineAuthorizationUpsertedV2, OrderDeleted, OrderIdentifierDeleted, OrderIdentifierDeletedV2, OrderIdentifierUpserted, OrderIdentifierUpsertedV2, OrderUpserted, OrganizationCountriesPublished, OrganizationDeleted, OrganizationRatecardTransitWindowsPublished, OrganizationRatesPublished, OrganizationUpserted, PaymentDeleted, PaymentUpserted, PriceBookDeleted, PriceBookItemDeleted, PriceBookItemUpserted, PriceBookUpserted, PricingDeleted, PricingUpserted, RateDeleted, RateUpserted, RefundCaptureUpsertedV2, RefundUpserted, RefundUpsertedV2, ReturnDeleted, ReturnUpserted, ReversalUpserted, RuleDeleted, RuleUpserted, SnapshotDeleted, SnapshotUpserted, SubcatalogDeleted, SubcatalogItemDeleted, SubcatalogItemUpserted, SubcatalogUpserted, TargetingItemDeleted, TargetingItemUpserted, TierDeleted, TierUpserted, TrackingLabelEventUpserted

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.



6024
6025
6026
6027
6028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6024

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.



6022
6023
6024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6022

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



6038
6039
6040
6041
6042
6043
6044
6045
6046
6047
6048
6049
6050
6051
6052
6053
6054
6055
6056
6057
6058
6059
6060
6061
6062
6063
6064
6065
6066
6067
6068
6069
6070
6071
6072
6073
6074
6075
6076
6077
6078
6079
6080
6081
6082
6083
6084
6085
6086
6087
6088
6089
6090
6091
6092
6093
6094
6095
6096
6097
6098
6099
6100
6101
6102
6103
6104
6105
6106
6107
6108
6109
6110
6111
6112
6113
6114
6115
6116
6117
6118
6119
6120
6121
6122
6123
6124
6125
6126
6127
6128
6129
6130
6131
6132
6133
6134
6135
6136
6137
6138
6139
6140
6141
6142
6143
6144
6145
6146
6147
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6038

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::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::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_PRICE_BOOK_MAPPING_DELETED; ExperiencePriceBookMappingDeleted.new(hash)
    when Types::EXPERIENCE_PRICE_BOOK_MAPPING_UPSERTED; ExperiencePriceBookMappingUpserted.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_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::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::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::ORGANIZATION_UPSERTED; OrganizationUpserted.new(hash)
    when Types::ORGANIZATION_DELETED; OrganizationDeleted.new(hash)
    when Types::AUTHORIZATION_UPSERTED; AuthorizationUpserted.new(hash)
    when Types::AUTHORIZATION_DELETED; AuthorizationDeleted.new(hash)
    when Types::AUTHORIZATION_DELETED_V2; AuthorizationDeletedV2.new(hash)
    when Types::AUTHORIZATION_STATUS_CHANGED; AuthorizationStatusChanged.new(hash)
    when Types::CARD_AUTHORIZATION_UPSERTED; CardAuthorizationUpserted.new(hash)
    when Types::CARD_AUTHORIZATION_UPSERTED_V2; CardAuthorizationUpsertedV2.new(hash)
    when Types::ONLINE_AUTHORIZATION_UPSERTED; OnlineAuthorizationUpserted.new(hash)
    when Types::ONLINE_AUTHORIZATION_UPSERTED_V2; OnlineAuthorizationUpsertedV2.new(hash)
    when Types::CAPTURE_UPSERTED; CaptureUpserted.new(hash)
    when Types::CAPTURE_UPSERTED_V2; CaptureUpsertedV2.new(hash)
    when Types::CARD_UPSERTED; CardUpserted.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; RefundUpserted.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::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::TRACKING_LABEL_EVENT_UPSERTED; TrackingLabelEventUpserted.new(hash)
    else EventUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



6030
6031
6032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6030

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, crossdock_shipment_upserted, rate_deleted, rate_upserted, available_promotions_upserted, available_promotions_deleted, allocation_deleted_v2, allocation_upserted_v2, currency_format_deleted, currency_format_upserted, experience_deleted, experience_upserted, experience_price_book_mapping_deleted, experience_price_book_mapping_upserted, 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_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, 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, 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, organization_upserted, organization_deleted, authorization_upserted, authorization_deleted, authorization_deleted_v2, authorization_status_changed, card_authorization_upserted, card_authorization_upserted_v2, online_authorization_upserted, online_authorization_upserted_v2, capture_upserted, capture_upserted_v2, card_upserted, card_upserted_v2, card_deleted, payment_upserted, payment_deleted, refund_upserted, refund_upserted_v2, refund_capture_upserted_v2, reversal_upserted, 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, tracking_label_event_upserted'
end

#to_hashObject



6034
6035
6036
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 6034

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