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

Inherits:
API
  • Object
show all
Defined in:
lib/github_api/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!, #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, root!, #run_callbacks, #set, #yield_or_eval

Methods included from Github::ClassMethods

#configuration, #configure, #require_all

Methods included from RateLimit

#ratelimit, #ratelimit_remaining, #ratelimit_reset

Methods included from Request::Verbs

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

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| ... }

62
63
64
65
66
67
68
# File 'lib/github_api/client/activity/events.rb', line 62

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:


87
88
89
90
91
92
93
# File 'lib/github_api/client/activity/events.rb', line 87

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:


113
114
115
116
117
118
119
# File 'lib/github_api/client/activity/events.rb', line 113

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:


186
187
188
189
190
191
192
193
194
195
196
197
198
# File 'lib/github_api/client/activity/events.rb', line 186

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:


15
16
17
18
19
20
21
# File 'lib/github_api/client/activity/events.rb', line 15

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:


148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/github_api/client/activity/events.rb', line 148

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| ... }

38
39
40
41
42
43
44
# File 'lib/github_api/client/activity/events.rb', line 38

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:


219
220
221
222
223
224
225
# File 'lib/github_api/client/activity/events.rb', line 219

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