Sha256: b26af94f66b67ac7ce44156d927f026209d9d80a2f10d3bded235cdfd56204b3

Contents?: true

Size: 1.4 KB

Versions: 9

Compression:

Stored size: 1.4 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: '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, params={})
      set :user => user_name, :repo => repo_name
      assert_presence_of user, repo
      normalize! params

      response = if (issue_id = params.delete('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={})
      set :user => user_name, :repo => 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

9 entries across 9 versions & 1 rubygems

Version Path
github_api-0.8.11 lib/github_api/issues/events.rb
github_api-0.8.10 lib/github_api/issues/events.rb
github_api-0.8.9 lib/github_api/issues/events.rb
github_api-0.8.8 lib/github_api/issues/events.rb
github_api-0.8.7 lib/github_api/issues/events.rb
github_api-0.8.6 lib/github_api/issues/events.rb
github_api-0.8.5 lib/github_api/issues/events.rb
github_api-0.8.4 lib/github_api/issues/events.rb
github_api-0.8.3 lib/github_api/issues/events.rb