Class: Io::Flow::V0::Models::ExportType

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

Overview

Defines the specific export data that defines which records are exported and into which format

Defined Under Namespace

Modules: Types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ ExportType

Returns a new instance of ExportType.



12020
12021
12022
12023
12024
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12020

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

Instance Attribute Details

#discriminatorObject (readonly)

Returns the value of attribute discriminator.



12018
12019
12020
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12018

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



12034
12035
12036
12037
12038
12039
12040
12041
12042
12043
12044
12045
12046
12047
12048
12049
12050
12051
12052
12053
12054
12055
12056
12057
12058
12059
12060
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12034

def ExportType.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[export_type] requires a field named 'discriminator'"
  end
  case discriminator
    when Types::; AccountTransactionsExportType.new(hash)
    when Types::; AccountOrdersExportType.new(hash)
    when Types::ANALYTICS_EXPORT_TYPE; AnalyticsExportType.new(hash)
    when Types::CATALOG_ITEM_EXPORT_TYPE; CatalogItemExportType.new(hash)
    when Types::EXPERIENCE_EXPORT_TYPE; ExperienceExportType.new(hash)
    when Types::HARMONIZATION_OVERVIEW_EXPORT_TYPE; HarmonizationOverviewExportType.new(hash)
    when Types::HARMONIZATION_HS6_EXPORT_TYPE; HarmonizationHs6ExportType.new(hash)
    when Types::HARMONIZATION_HS10_EXPORT_TYPE; HarmonizationHs10ExportType.new(hash)
    when Types::HARMONIZATION_TARIFF_CODES_EXPORT_TYPE; HarmonizationTariffCodesExportType.new(hash)
    when Types::UNHARMONIZED_ITEM_EXPORT_TYPE; UnharmonizedItemExportType.new(hash)
    when Types::ORDER_EXPORT_TYPE; OrderExportType.new(hash)
    when Types::PRICE_BOOK_ITEM_EXPORT_TYPE; PriceBookItemExportType.new(hash)
    when Types::SOLIDUS_PRODUCT_EXPORT_TYPE; SolidusProductExportType.new(hash)
    when Types::SOLIDUS_VARIANT_EXPORT_TYPE; SolidusVariantExportType.new(hash)
    when Types::LOCALIZED_ITEM_PRICES_EXPORT_TYPE; LocalizedItemPricesExportType.new(hash)
    when Types::MARKETING_FEEDS_EXPORT_TYPE; MarketingFeedsExportType.new(hash)
    when Types::EXCLUSION_RULES_EXPORT_TYPE; ExclusionRulesExportType.new(hash)
    else ExportTypeUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



12026
12027
12028
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12026

def subtype_to_hash
  raise 'Cannot serialize an instance of export_type directly - must use one of the specific types: account_transactions_export_type, account_orders_export_type, analytics_export_type, catalog_item_export_type, experience_export_type, harmonization_overview_export_type, harmonization_hs6_export_type, harmonization_hs10_export_type, harmonization_tariff_codes_export_type, unharmonized_item_export_type, order_export_type, price_book_item_export_type, solidus_product_export_type, solidus_variant_export_type, localized_item_prices_export_type, marketing_feeds_export_type, exclusion_rules_export_type'
end

#to_hashObject



12030
12031
12032
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 12030

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