Class: Github::Client::Activity::Events

Inherits:
API
  • Object
show all
Defined in:
lib/github_api2/client/activity/events.rb

Constant Summary

Constants included from MimeType

MimeType::MEDIA_LOOKUP

Constants included from Github::Constants

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

Instance Attribute Summary

Attributes inherited from API

#current_options

Instance Method Summary collapse

Methods inherited from API

after_callbacks, after_request, #api_methods_in, #arguments, before_callbacks, before_request, clear_request_methods!, #disable_redirects, #execute, extend_with_actions, extra_methods, #extract_basic_auth, extract_class_name, #filter_callbacks, inherited, #initialize, internal_methods, method_added, #method_missing, #module_methods_in, namespace, request_methods, require_all, #respond_to?, root!, #run_callbacks, #set, #yield_or_eval

Methods included from Request::Verbs

#delete_request, #get_request, #head_request, #options_request, #patch_request, #post_request, #put_request

Methods included from RateLimit

#ratelimit, #ratelimit_remaining, #ratelimit_reset

Methods included from MimeType

#lookup_media, #parse

Methods included from 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| ... }


64
65
66
67
68
69
70
# File 'lib/github_api2/client/activity/events.rb', line 64

def issue(*args)
  arguments(args, required: [:user, :repo])

  response = get_request("/repos/#{arguments.user}/#{arguments.repo}/issues/events", arguments.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| ... }

See Also:



89
90
91
92
93
94
95
# File 'lib/github_api2/client/activity/events.rb', line 89

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

  response = get_request("/networks/#{arguments.user}/#{arguments.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 name: 'org-name'
github.activity.events.org name: 'org-name' { |event| ... }

See Also:



115
116
117
118
119
120
121
# File 'lib/github_api2/client/activity/events.rb', line 115

def org(*args)
  arguments(args, required: [:name])

  response = get_request("/orgs/#{arguments.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.

List all public events that a user has performed

Examples:

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

See Also:



188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/github_api2/client/activity/events.rb', line 188

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

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

  response = get_request("/users/#{arguments.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| ... }

See Also:



17
18
19
20
21
22
23
# File 'lib/github_api2/client/activity/events.rb', line 17

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.

List all public events that a user has received

Examples:

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

See Also:



150
151
152
153
154
155
156
157
158
159
160
161
162
# File 'lib/github_api2/client/activity/events.rb', line 150

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

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

  response = get_request("/users/#{arguments.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| ... }


40
41
42
43
44
45
46
# File 'lib/github_api2/client/activity/events.rb', line 40

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

  response = get_request("/repos/#{arguments.user}/#{arguments.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', name: 'org-name'
github.activity.events.user_org user: 'user-name', name: 'org-name' {|event| ...}

See Also:



221
222
223
224
225
226
227
# File 'lib/github_api2/client/activity/events.rb', line 221

def user_org(*args)
  arguments(args, required: [:user, :name])

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