Sha256: e0cf5a20fe087e4a10f71bd9b2bb58d5a4c9174ef5824cc750d627f1f25f214a

Contents?: true

Size: 1.47 KB

Versions: 6

Compression:

Stored size: 1.47 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)
      _validate_user_repo_params(user, repo) unless 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)
      _validate_user_repo_params(user, repo) unless user? && repo?
      _validate_presence_of 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

6 entries across 6 versions & 1 rubygems

Version Path
github_api-0.7.0 lib/github_api/issues/events.rb
github_api-0.6.5 lib/github_api/issues/events.rb
github_api-0.6.4 lib/github_api/issues/events.rb
github_api-0.6.3 lib/github_api/issues/events.rb
github_api-0.6.2 lib/github_api/issues/events.rb
github_api-0.6.1 lib/github_api/issues/events.rb