Class: GoApiClient::Api::Feed
- Inherits:
-
AbstractApi
- Object
- GoApiClient::AttributeHelper
- AbstractApi
- GoApiClient::Api::Feed
- Defined in:
- lib/go_api_client/api/feed.rb
Instance Method Summary collapse
- #feed(options = {}) ⇒ Object
-
#initialize(attributes = {}) ⇒ Feed
constructor
A new instance of Feed.
Constructor Details
#initialize(attributes = {}) ⇒ Feed
Returns a new instance of Feed.
7 8 9 |
# File 'lib/go_api_client/api/feed.rb', line 7 def initialize(attributes = {}) super(attributes) end |
Instance Method Details
#feed(options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/go_api_client/api/feed.rb', line 11 def feed(={}) = ({:pipeline_name => nil, :feed_uri => nil, :eager_parser => []}).merge() if [:feed_uri] uri = [:feed_uri] else raise 'Insufficient arguments' unless [:pipeline_name] uri = "#{@base_uri}/api/pipelines/#{[:pipeline_name]}/stages.xml" end feed = GoApiClient::Parsers::Feed.parse(Nokogiri::XML(@http_fetcher.get!(uri)).root) if [:eager_parser] if [:eager_parser].include?(:stage) stage_api = GoApiClient::Api::Stage.new({:base_uri => @base_uri, :http_fetcher => @http_fetcher}) feed.parsed_entries.each do |entry| entry.parsed_stage = stage_api.stage(.merge({:stage_uri => entry.stage_uri})) end end if [:eager_parser].include?(:pipeline) pipeline_api = GoApiClient::Api::Pipeline.new({:base_uri => @base_uri, :http_fetcher => @http_fetcher}) feed.parsed_entries.each do |entry| entry.parsed_pipeline = pipeline_api.pipeline(.merge({:pipeline_uri => entry.pipeline_uri})) end end end feed end |