Sha256: 6fe792b009201c56e824216269e0289b5155bf178e177bb6292db14e3c10b16f

Contents?: true

Size: 1.38 KB

Versions: 1

Compression:

Stored size: 1.38 KB

Contents

# encoding: utf-8

module Github
  class Issues::Events < API

    # Creates new Issues::Events API
    def initialize(options = {})
      super(options)
    end

    # List events for an issue
    #
    # = Examples
    #  github = Github.new
    #  github.issues.events.list 'user-name', 'repo-name', 'issue-id'
    #
    # List events for a repository
    #
    # = Examples
    #  github = Github.new
    #  github.issues.events.list 'user-name', 'repo-name'
    #
    def list(user_name, repo_name, issue_id=nil, params={})
      _update_user_repo_params(user_name, repo_name)
      assert_presence_of user, repo
      normalize! params

      response = if issue_id
        get_request("/repos/#{user}/#{repo}/issues/#{issue_id}/events", params)
      else
        get_request("/repos/#{user}/#{repo}/issues/events", params)
      end
      return response unless block_given?
      response.each { |el| yield el }
    end
    alias :all :list

    # Get a single event
    #
    # = Examples
    #  github = Github.new
    #  github.issues.events.get 'user-name', 'repo-name', 'event-id'
    #
    def get(user_name, repo_name, event_id, params={})
      _update_user_repo_params(user_name, repo_name)
      assert_presence_of user, repo, event_id
      normalize! params

      get_request("/repos/#{user}/#{repo}/issues/events/#{event_id}")
    end
    alias :find :get

  end # Issues::Events
end # Github

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
github_api-0.7.1 lib/github_api/issues/events.rb