Module: Pushpad

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

Defined Under Namespace

Modules: Request Classes: Notification, Project, Sender, Subscription

Constant Summary collapse

@@auth_token =
nil
@@project_id =
nil

Class Method Summary collapse

Class Method Details

.auth_tokenObject



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

def self.auth_token
  @@auth_token
end

.auth_token=(auth_token) ⇒ Object



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

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

.project_idObject



21
22
23
# File 'lib/pushpad.rb', line 21

def self.project_id
  @@project_id
end

.project_id=(project_id) ⇒ Object



25
26
27
# File 'lib/pushpad.rb', line 25

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

.signature_for(data) ⇒ Object



29
30
31
32
# File 'lib/pushpad.rb', line 29

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