Class: Io::Flow::V0::Models::CatalogFeed

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

Overview

Describes a catalog feed.

Instance Attribute Summary collapse

Attributes inherited from Feed

#discriminator

Instance Method Summary collapse

Methods inherited from Feed

from_json, #to_hash

Constructor Details

#initialize(incoming = {}) ⇒ CatalogFeed

Returns a new instance of CatalogFeed.



14327
14328
14329
14330
14331
14332
14333
14334
14335
14336
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14327

def initialize(incoming={})
  super(:discriminator => Feed::Types::CATALOG_FEED)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :experience_feed_summaries, :incoming_feed, :outgoing_feed, :feed_statistics_summary], 'CatalogFeed')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @experience_feed_summaries = HttpClient::Preconditions.assert_class('experience_feed_summaries', opts.delete(:experience_feed_summaries), Array).map { |v| (x = v; x.is_a?(::Io::Flow::V0::Models::ExperienceFeedSummary) ? x : ::Io::Flow::V0::Models::ExperienceFeedSummary.new(x)) }
  @incoming_feed = (x = opts.delete(:incoming_feed); x.is_a?(::Io::Flow::V0::Models::IncomingFeed) ? x : ::Io::Flow::V0::Models::IncomingFeed.new(x))
  @outgoing_feed = (x = opts.delete(:outgoing_feed); x.is_a?(::Io::Flow::V0::Models::OutgoingFeed) ? x : ::Io::Flow::V0::Models::OutgoingFeed.new(x))
  @feed_statistics_summary = (x = opts.delete(:feed_statistics_summary); x.is_a?(::Io::Flow::V0::Models::FeedStatisticsSummary) ? x : ::Io::Flow::V0::Models::FeedStatisticsSummary.new(x))
end

Instance Attribute Details

#experience_feed_summariesObject (readonly)

Returns the value of attribute experience_feed_summaries.



14325
14326
14327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14325

def experience_feed_summaries
  @experience_feed_summaries
end

#feed_statistics_summaryObject (readonly)

Returns the value of attribute feed_statistics_summary.



14325
14326
14327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14325

def feed_statistics_summary
  @feed_statistics_summary
end

#idObject (readonly)

Returns the value of attribute id.



14325
14326
14327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14325

def id
  @id
end

#incoming_feedObject (readonly)

Returns the value of attribute incoming_feed.



14325
14326
14327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14325

def incoming_feed
  @incoming_feed
end

#outgoing_feedObject (readonly)

Returns the value of attribute outgoing_feed.



14325
14326
14327
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14325

def outgoing_feed
  @outgoing_feed
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



14342
14343
14344
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14342

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

#subtype_to_hashObject



14346
14347
14348
14349
14350
14351
14352
14353
14354
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14346

def subtype_to_hash
  {
    :id => id,
    :experience_feed_summaries => experience_feed_summaries.map { |o| o.to_hash },
    :incoming_feed => incoming_feed.to_hash,
    :outgoing_feed => outgoing_feed.to_hash,
    :feed_statistics_summary => feed_statistics_summary.to_hash
  }
end

#to_jsonObject



14338
14339
14340
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 14338

def to_json
  JSON.dump(to_hash)
end