Module: Pushpad

Defined in:
lib/pushpad.rb,
lib/pushpad/request.rb,
lib/pushpad/notification.rb,
lib/pushpad/subscription.rb

Defined Under Namespace

Modules: Request Classes: Notification, Subscription

Constant Summary collapse

@@auth_token =
nil
@@project_id =
nil

Class Method Summary collapse

Class Method Details

.auth_tokenObject



11
12
13
# File 'lib/pushpad.rb', line 11

def self.auth_token
  @@auth_token
end

.auth_token=(auth_token) ⇒ Object



15
16
17
# File 'lib/pushpad.rb', line 15

def self.auth_token=(auth_token)
  @@auth_token = auth_token
end

.project_idObject



19
20
21
# File 'lib/pushpad.rb', line 19

def self.project_id
  @@project_id
end

.project_id=(project_id) ⇒ Object



23
24
25
# File 'lib/pushpad.rb', line 23

def self.project_id=(project_id)
  @@project_id = project_id
end

.signature_for(data) ⇒ Object



27
28
29
30
# File 'lib/pushpad.rb', line 27

def self.signature_for(data)
  raise "You must set Pushpad.auth_token" unless Pushpad.auth_token
  OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), self.auth_token, data.to_s)
end