Class: Github::Activity::Events

Inherits:
Github::API show all
Defined in:
lib/github_api/activity/events.rb

Constant Summary

Constants included from Request

Request::METHODS, Request::METHODS_WITH_BODIES

Constants included from Connection

Connection::ALLOWED_OPTIONS

Constants included from Constants

Constants::ACCEPT, Constants::ACCEPTED_OAUTH_SCOPES, Constants::ACCEPT_CHARSET, Constants::CACHE_CONTROL, Constants::CONTENT_LENGTH, Constants::CONTENT_TYPE, Constants::DATE, Constants::ETAG, Constants::HEADER_LAST, Constants::HEADER_LINK, Constants::HEADER_NEXT, Constants::LOCATION, Constants::META_FIRST, Constants::META_LAST, Constants::META_NEXT, Constants::META_PREV, Constants::META_REL, Constants::OAUTH_SCOPES, Constants::PARAM_PAGE, Constants::PARAM_PER_PAGE, Constants::PARAM_START_PAGE, Constants::RATELIMIT_LIMIT, Constants::RATELIMIT_REMAINING, Constants::SERVER, Constants::USER_AGENT

Constants included from MimeType

MimeType::MEDIA_LOOKUP

Instance Attribute Summary

Attributes inherited from Github::API

#current_options

Attributes included from Github::Authorization

#scopes

Instance Method Summary collapse

Methods inherited from Github::API

#api_methods_in, #append_arguments, #arguments, inherited, #initialize, #method_missing, #process_basic_auth, #set, #setup, #with, #yield_or_eval

Methods included from RateLimit

#ratelimit, #ratelimit_remaining

Methods included from Request

#delete_request, #get_request, #patch_request, #post_request, #put_request, #request

Methods included from Connection

#caching?, #clear_cache, #connection, #default_middleware, #default_options, #stack

Methods included from MimeType

#lookup_media, #parse

Methods included from Github::Authorization

#auth_code, #authenticated?, #authentication, #authorize_url, #basic_authed?, #client, #get_token

Constructor Details

This class inherits a constructor from Github::API

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Github::API

Instance Method Details

#issue(*args) ⇒ Object Also known as: issues, issue_events, list_issue_events

List all issue events for a given repository

Examples

github = Github.new
github.activity.events.issue 'user-name', 'repo-name'
github.activity.events.issue 'user-name', 'repo-name' { |event| ... }

github.activity.events.issue user: 'user-name', repo: 'repo-name'
github.activity.events.issue user: 'user-name', repo: 'repo-name' { |event| ... }


56
57
58
59
60
61
62
63
# File 'lib/github_api/activity/events.rb', line 56

def issue(*args)
  arguments(args, :required => [:user, :repo])
  params = arguments.params

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

#network(*args) ⇒ Object Also known as: repo_network, repository_network, list_repo_network_events, list_repository_network_events

List all public events for a network of repositories

Examples

github = Github.new
github.activity.events.network 'user-name', 'repo-name'
github.activity.events.network 'user-name', 'repo-name' { |event| ... }

github.activity.events.network user: 'user-name', repo: 'repo-name'
github.activity.events.network user: 'user-name', repo: 'repo-name' { |event| ... }


78
79
80
81
82
83
84
# File 'lib/github_api/activity/events.rb', line 78

def network(*args)
  arguments(args, :required => [:user, :repo])

  response = get_request("/networks/#{user}/#{repo}/events", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#org(*args) ⇒ Object Also known as: organization, list_orgs, list_org_events, list_organization_events

List all public events for an organization

Examples

github = Github.new
github.activity.events.org 'org-name'
github.activity.events.org 'org-name' { |event| ... }

github.activity.events.org org: 'org-name'
github.activity.events.org org: 'org-name' { |event| ... }


100
101
102
103
104
105
106
# File 'lib/github_api/activity/events.rb', line 100

def org(*args)
  arguments(args, :required => [:org_name])

  response = get_request("/orgs/#{org_name}/events", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#performed(*args) ⇒ Object Also known as: user_performed, list_user_performed

List all events that a user has performed

If you are authenticated as the given user, you will see your private events. Otherwise, you’ll only see public events.

Examples

github = Github.new
github.activity.events.performed 'user-name'
github.activity.events.performed 'user-name' { |event| ... }

List all public events that a user has performed

Examples

github = Github.new
github.activity.events.performed 'user-name', :public => true
github.activity.events.performed 'user-name', :public => true { |event| ... }


163
164
165
166
167
168
169
170
171
172
173
174
175
# File 'lib/github_api/activity/events.rb', line 163

def performed(*args)
  arguments(args, :required => [:user])
  params = arguments.params

  public_events = if params['public']
    params.delete('public')
    '/public'
  end

  response = get_request("/users/#{user}/events#{public_events}", params)
  return response unless block_given?
  response.each { |el| yield el }
end

#public(*args) ⇒ Object Also known as: public_events, list_public, list_public_events

List all public events

Examples

github = Github.new
github.activity.events.public
github.activity.events.public { |event| ... }


13
14
15
16
17
18
19
# File 'lib/github_api/activity/events.rb', line 13

def public(*args)
  arguments(args)

  response = get_request("/events", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#received(*args) ⇒ Object Also known as: user_received, list_user_received

List all events that a user has received

These are events that you’ve received by watching repos and following users. If you are authenticated as the given user, you will see private events. Otherwise, you’ll only see public events.

Examples

github = Github.new
github.activity.events.received 'user-name'
github.activity.events.received 'user-name' { |event| ... }

List all public events that a user has received

Examples

github = Github.new
github.activity.events.received 'user-name', :public => true
github.activity.events.received 'user-name', :public => true { |event| ... }


130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/github_api/activity/events.rb', line 130

def received(*args)
  arguments(args, :required => [:user])
  params = arguments.params

  public_events = if params['public']
    params.delete('public')
    '/public'
  end

  response = get_request("/users/#{user}/received_events#{public_events}", params)
  return response unless block_given?
  response.each { |el| yield el }
end

#repository(*args) ⇒ Object Also known as: repos, repo_events, repository_events, list_repository_events

List all repository events for a given user

Examples

github = Github.new
github.activity.events.repository 'user-name', 'repo-name'
github.activity.events.repository 'user-name', 'repo-name' { |event| ... }

github.activity.events.repository user: 'user-name', repo: 'repo-name'
github.activity.events.repository user: 'user-name', repo: 'repo-name' {|event| ... }


34
35
36
37
38
39
40
# File 'lib/github_api/activity/events.rb', line 34

def repository(*args)
  arguments(args, :required => [:user, :repo])

  response = get_request("/repos/#{user}/#{repo}/events", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end

#user_org(*args) ⇒ Object Also known as: user_organization, list_user_org, list_user_org_events, list_user_organization_events

List all events for an organization

This is the user’s organization dashboard. You must be authenticated as the user to view this.

Examples

github = Github.new
github.activity.events.user_org 'user-name', 'org-name'
github.activity.events.user_org 'user-name', 'org-name' { |event| ... }

github.activity.events.user_org user: 'user-name', org_name: 'org-name'
github.activity.events.user_org user: 'user-name', org_name: 'org-name' {|event| ...}


192
193
194
195
196
197
198
199
# File 'lib/github_api/activity/events.rb', line 192

def user_org(*args)
  arguments(args, :required => [:user, :org_name])
  params = arguments.params

  response = get_request("/users/#{user}/events/orgs/#{org_name}", params)
  return response unless block_given?
  response.each { |el| yield el }
end