Sha256: c49b63493c6021cece923fe5992455079fbbb0a988402249edc7614962b633e5

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 KB

Contents

# encoding: utf-8

require_relative '../../api'

module Github
  class Client::Activity::Feeds < API
    # List all the feeds available to the authenticated user.
    #
    # @see https://developer.github.com/v3/activity/feeds/#list-feeds
    #
    # @example
    #   github = Github.new
    #   github.activity.feeds.list
    #
    # @api public
    def list(*args)
      arguments(args)

      response = get_request("/feeds", arguments.params)
      return response unless block_given?
      response.each { |el| yield el }
    end
    alias_method :all, :list

    # Get all the items for a named timeline
    #
    # @see https://developer.github.com/v3/activity/feeds/#list-feeds
    #
    # @example
    #   github = Github.new
    #   github.activity.feeds.get "timeline"
    #
    # @param [String] name
    #   the name of the timeline resource
    #
    # @api public
    def get(*args)
      arguments(args, required: [:name])

      name = arguments.name
      response = list.body._links[name]
      if response
        params = arguments.params
        params['accept'] = response.type
        get_request(response.href, params)
      end
    end
    alias_method :find, :get
  end
end # Github

Version data entries

6 entries across 6 versions & 3 rubygems

Version Path
github_api2-1.0.1 lib/github_api2/client/activity/feeds.rb
github_api2-1.0.0 lib/github_api2/client/activity/feeds.rb
github_api-0.19.0 lib/github_api/client/activity/feeds.rb
lingfennan-github_api-0.18.2 lib/github_api/client/activity/feeds.rb
github_api-0.18.2 lib/github_api/client/activity/feeds.rb
github_api-0.18.1 lib/github_api/client/activity/feeds.rb