Parent

Class/Module Index [+]

Quicksearch

Github::Activity::Notifications

Public Instance Methods

all(*args) click to toggle source
Alias for: list
create(*args) click to toggle source

Create a thread subscription

This lets you subscribe to a thread, or ignore it. Subscribing to a thread is unnecessary if the user is already subscribed to the repository. Ignoring a thread will mute all future notifications (until you comment or get @mentioned).

Parameters

  • :subscribed - boolean - determines if notifications should be

    received from this thread.
  • :ignored - boolean - deterimines if all notifications should be

    blocked from this thread.

Examples

github = Github.new oauth_token: 'token'
github.activity.notifications.create 'thread-id',
  'subscribed': true
  'ignored': false
# File lib/github_api/activity/notifications.rb, line 136
def create(*args)
  arguments(args, :required => [:thread_id])

  put_request("/notifications/threads/#{thread_id}/subscription", arguments.params)
end
delete(*args) click to toggle source

Delete a thread subscription

Examples

github = Github.new oauth_token: 'token'
github.activity.notifications.delete 'thread_id'
# File lib/github_api/activity/notifications.rb, line 148
def delete(*args)
  arguments(args, :required => [:thread_id])

  delete_request("/notifications/threads/#{thread_id}/subscription", arguments.params)
end
Also aliased as: remove
find(*args) click to toggle source
Alias for: get
get(*args) click to toggle source

View a single thread

Examples

github = Github.new oauth_token: 'token'
github.activity.notifications.get 'thread_id'
github.activity.notifications.get 'thread_id' { |thread| ... }
# File lib/github_api/activity/notifications.rb, line 52
def get(*args)
  arguments(args, :required => [:thread_id])

  response = get_request("/notifications/threads/#{thread_id}", arguments.params)
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: find
list(*args) click to toggle source

List your notifications

List all notifications for the current user, grouped by repository.

Parameters

  • :all - Optional boolean - true to show notifications marked as read.

  • :participating - Optional boolean - true to show only

    notifications in which the user is directly
    participating or mentioned.
  • :since - Optional string - filters out any notifications updated

    before the given time. The time should be passed in as
    UTC in the ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    Example: “2012-10-09T23:39:01Z”.

Examples

github = Github.new oauth_token: 'token'
github.activity.notifications.list

List your notifications in a repository

Examples

github = Github.new
github.activity.notifications.list user: 'user-name', repo: 'repo-name'
# File lib/github_api/activity/notifications.rb, line 29
def list(*args)
  params = arguments(args) do
    sift ] all participating since user repo]
  end.params

  response = if ( (user_name = params.delete("user")) &&
                  (repo_name = params.delete("repo")) )
    get_request("/repos/#{user_name}/#{repo_name}/notifications", params)
  else
    get_request("/notifications", params)
  end
  return response unless block_given?
  response.each { |el| yield el }
end
Also aliased as: all
mark(*args) click to toggle source

Mark as read

Marking a notification as “read” removes it from the default view on GitHub.com.

Parameters

  • :unread - boolean - Changes the unread status of the threads.

  • :read - boolean - Inverse of "unread"

  • :last_read_at - optional string time - describes the last point

    that notifications were checked. Anything updated 
    since this time will not be updated. Default: Now.
    Expected in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
    Example: “2012-10-09T23:39:01Z”.

Examples

github = Github.new oauth_token: 'token'
github.activity.notifications.mark read: true

Mark notifications as read in a repository

Examples

github.activity.notifications.mark user: 'user-name', repo: 'repo-name',
  read: true

Mark a thread as read

Examples

github.activity.notifications.mark thread_id: 'id', read: true
# File lib/github_api/activity/notifications.rb, line 90
def mark(*args)
  params = arguments(args) do
    sift ] unread read last_read_at user repo thread_id]
  end.params

  if ( (user_name = params.delete("user")) &&
       (repo_name = params.delete("repo")) )

    put_request("/repos/#{user_name}/#{repo_name}/notifications", params)
  elsif (thread_id = params.delete("thread_id"))
    patch_request("/notifications/threads/#{thread_id}", params)
  else
    put_request("/notifications", params)
  end
end
remove(*args) click to toggle source
Alias for: delete
subscribed?(*args) click to toggle source

Check to see if the current user is subscribed to a thread.

Examples

github = Github.new oauth_token: 'token'
github.activity.notifications.subscribed? 'thread-id'
# File lib/github_api/activity/notifications.rb, line 112
def subscribed?(*args)
  arguments(args, :required => [:thread_id])

  get_request("/notifications/threads/#{thread_id}/subscription", arguments.params)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.