Sha256: 37740a88f362d8dc517597e25eab4a3f791317ad257ebb787f098ac0b957d972

Contents?: true

Size: 1.32 KB

Versions: 16

Compression:

Stored size: 1.32 KB

Contents

# encoding: utf-8

module Github
  class Client::Issues::Events < API
    # List events for an issue
    #
    # @example
    #  github = Github.new
    #  github.issues.events.list 'user-name', 'repo-name',
    #    issue_number: 'issue-number'
    #
    # List events for a repository
    #
    # @example
    #  github = Github.new
    #  github.issues.events.list 'user-name', 'repo-name'
    #
    # @api public
    def list(*args)
      arguments(args, required: [:user, :repo])
      params = arguments.params

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

    # Get a single event
    #
    # @example
    #  github = Github.new
    #  github.issues.events.get 'user-name', 'repo-name', 'event-id'
    #
    # @api public
    def get(*args)
      arguments(args, :required => [:user, :repo, :id])
      params = arguments.params

      get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/events/#{arguments.id}", params)
    end
    alias :find :get
  end # Issues::Events
end # Github

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
github_api-0.17.0 lib/github_api/client/issues/events.rb
github_api-0.16.0 lib/github_api/client/issues/events.rb
github_api-0.15.0 lib/github_api/client/issues/events.rb
github_api-0.14.5 lib/github_api/client/issues/events.rb
github_api-0.14.4 lib/github_api/client/issues/events.rb
github_api-0.14.3 lib/github_api/client/issues/events.rb
github_api-0.14.2 lib/github_api/client/issues/events.rb
github_api-0.14.1 lib/github_api/client/issues/events.rb
github_api-0.14.0 lib/github_api/client/issues/events.rb
github_api-0.13.1 lib/github_api/client/issues/events.rb
github_api-0.13.0 lib/github_api/client/issues/events.rb
github_api-0.12.4 lib/github_api/client/issues/events.rb
github_api-0.12.3 lib/github_api/client/issues/events.rb
github_api-0.12.2 lib/github_api/client/issues/events.rb
github_api-0.12.1 lib/github_api/client/issues/events.rb
github_api-0.12.0 lib/github_api/client/issues/events.rb