Class: Github::Notification

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/hubdate/notification.rb

Instance Attribute Summary

Attributes included from Base

#connection, #response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Base

#initialize, #method_missing

Dynamic Method Handling

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

Class Method Details

.fetch(conn = Github::Connection.new) ⇒ Object

Generate JSON hash and create new Github::Repository object through Github::Base

Raises:

  • (ArgumentError)


6
7
8
9
10
11
# File 'lib/hubdate/notification.rb', line 6

def self.fetch(conn = Github::Connection.new)
  raise ArgumentError.new("You must be authenticated to retrieve this information!") if !connection.authenticated?

  responseHash = conn.get("/notifications")
  new(responseHash, conn)
end

.list(params = {}, conn = Github::Connection.new) ⇒ Object

Do some argument checking and then return an array of repository objects



22
23
24
25
26
27
28
29
30
31
# File 'lib/hubdate/notification.rb', line 22

def self.list(params = {}, conn = Github::Connection.new)
  conn = params if params.class == Github::Connection
  params = {} if params.class == Github::Connection

  notifications = conn.get("/notifications", params)

  notifications.map do |notification|
    new(notification, conn)
  end
end

Instance Method Details

#messageObject



13
14
15
# File 'lib/hubdate/notification.rb', line 13

def message
  subject["title"]
end

#typeObject



17
18
19
# File 'lib/hubdate/notification.rb', line 17

def type
  subject["type"]
end