Class: YourMembership::Feeds

Inherits:
Base
  • Object
show all
Defined in:
lib/your_membership/feeds.rb

Overview

YourMembership Feeds Namespace

Class Method Summary collapse

Methods inherited from Base

build_XML_request, new_call_id, post, response_to_array, response_to_array_of_hashes, response_valid?, response_ym_error?

Class Method Details

.feed_get(session, feed_id, options = {}) ⇒ Nokogiri::XML

Returns a RSS 2.0 community feed

Parameters:

  • session (YourMembership::Session)
  • feed_id (String)

    ID of the Feed to be returned.

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :PageSize (Integer)

    The maximum number of records in the returned result set.

  • :StartRecord (Integer)

    The record number at which to start the returned result set.

Returns:

  • (Nokogiri::XML)

    Returns a Nokogiri XML document that represents an rss feed

See Also:



27
28
29
30
31
32
33
34
35
# File 'lib/your_membership/feeds.rb', line 27

def self.feed_get(session, feed_id, options = {})
  options[:FeedID] = feed_id

  response = post('/', :body => build_XML_request('Feeds.Feed.Get', session, options))

  response_valid? response
  xml_body = Nokogiri::XML response.body
  xml_body.at_xpath '//rss'
end

.get(session) ⇒ Array

Returns a list of RSS 2.0 community feeds.

Parameters:

Returns:

  • (Array)

    Returns an Array of Hashes representing all of your community’s feeds.

See Also:



10
11
12
13
14
15
# File 'lib/your_membership/feeds.rb', line 10

def self.get(session)
  response = post('/', :body => build_XML_request('Feeds.Get', session))

  response_valid? response
  response_to_array_of_hashes response['YourMembership_Response']['Feeds.Get'], ['Feed']
end