Class: Io::Flow::V0::Models::IncomingFeed

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

Overview

Describe a feed incoming to Flow

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ IncomingFeed

Returns a new instance of IncomingFeed.



20457
20458
20459
20460
20461
20462
20463
20464
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20457

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:url, :format, :item_link], 'IncomingFeed')
  @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String)
  @format = (x = opts.delete(:format); x.is_a?(::Io::Flow::V0::Models::IncomingFeedFormat) ? x : ::Io::Flow::V0::Models::IncomingFeedFormat.apply(x))
  @minute = HttpClient::Preconditions.assert_class('minute', (x = opts.delete(:minute); x.nil? ? 55 : x), Integer)
  @item_link = (x = opts.delete(:item_link); x.is_a?(::Io::Flow::V0::Models::ItemLink) ? x : ::Io::Flow::V0::Models::ItemLink.new(x))
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



20455
20456
20457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20455

def format
  @format
end

Returns the value of attribute item_link.



20455
20456
20457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20455

def item_link
  @item_link
end

#minuteObject (readonly)

Returns the value of attribute minute.



20455
20456
20457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20455

def minute
  @minute
end

#urlObject (readonly)

Returns the value of attribute url.



20455
20456
20457
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20455

def url
  @url
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



20470
20471
20472
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20470

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

#to_hashObject



20474
20475
20476
20477
20478
20479
20480
20481
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20474

def to_hash
  {
    :url => url,
    :format => format.value,
    :minute => minute,
    :item_link => item_link.to_hash
  }
end

#to_jsonObject



20466
20467
20468
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 20466

def to_json
  JSON.dump(to_hash)
end