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.



9955
9956
9957
9958
9959
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9955

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.



9953
9954
9955
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9953

def discriminator
  @discriminator
end

Class Method Details

.from_json(hash) ⇒ Object



9969
9970
9971
9972
9973
9974
9975
9976
9977
9978
9979
9980
9981
9982
9983
9984
9985
9986
9987
9988
9989
9990
9991
9992
9993
9994
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9969

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::ACCOUNT_TRANSACTIONS_EXPORT_TYPE; AccountTransactionsExportType.new(hash)
    when Types::ACCOUNT_ORDERS_EXPORT_TYPE; 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)
    else ExportTypeUndefinedType.new(:discriminator => discriminator)
  end
end

Instance Method Details

#subtype_to_hashObject



9961
9962
9963
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9961

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'
end

#to_hashObject



9965
9966
9967
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 9965

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