Sha256: 7be27c7e9c634fd15438ac11ef3e42b3095a09c281402b176105e58218298e83

Contents?: true

Size: 1.35 KB

Versions: 12

Compression:

Stored size: 1.35 KB

Contents

# encoding: utf-8

module Github
  class Issues
    module Events

    # List events for an issue
    #
    # = Examples
    #  @github = Github.new
    #  @github.issues.events 'user-name', 'repo-name', 'issue-id'
    #
    # List events for a repository
    #
    # = Examples
    #  @github = Github.new
    #  @github.issues.events 'user-name', 'repo-name'
    #
    def events(user_name=nil, repo_name=nil, issue_id=nil, params={})
      _update_user_repo_params(user_name, repo_name)
      _validate_user_repo_params(user, repo) unless user? && repo?
      _normalize_params_keys(params)

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

    # Get a single event
    #
    # = Examples
    #  @github = Github.new
    #  @github.issues.event 'user-name', 'repo-name', 'event-id'
    #
    def event(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_keys(params)

      get("/repos/#{user}/#{repo}/issues/events/#{event_id}")
    end

    end # Events
  end # Issues
end # Github

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
github_api-0.3.4 lib/github_api/issues/events.rb
github_api-0.3.3 lib/github_api/issues/events.rb
github_api-0.3.2 lib/github_api/issues/events.rb
github_api-0.3.1 lib/github_api/issues/events.rb
github_api-0.3.0 lib/github_api/issues/events.rb
github_api-0.2.2 lib/github_api/issues/events.rb
github_api-0.2.1 lib/github_api/issues/events.rb
github_api-0.2.0 lib/github_api/issues/events.rb
github_api-0.1.2 lib/github_api/issues/events.rb
github_api-0.1.1 lib/github_api/issues/events.rb
github_api-0.1.0 lib/github_api/issues/events.rb
github_api-0.1.0.pre lib/github_api/issues/events.rb