Class: Airgram

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/airgram.rb

Defined Under Namespace

Classes: AuthenticationError

Instance Method Summary collapse

Constructor Details

#initialize(auth = {}) ⇒ Airgram

Returns a new instance of Airgram.



9
10
11
# File 'lib/airgram.rb', line 9

def initialize(auth={})
  @auth = auth
end

Instance Method Details

#broadcast(msg, url = nil) ⇒ Object



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

def broadcast(msg, url=nil)
  check_auth_details!
  request_successful?( post("/broadcast", {:msg => msg, :url => url}, @auth) )
end

#send(email, msg, url = nil) ⇒ Object



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

def send(email, msg, url=nil)
  check_auth_details!
  request_successful?( post("/send", {:email => email, :msg => msg, :url => url}, @auth) )
end

#send_as_guest(email, msg, url = nil) ⇒ Object



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

def send_as_guest(email, msg, url=nil)
  request_successful?( post("/send_as_guest", :email => email, :msg => msg, :url => url) )
end

#subscribe(email) ⇒ Object



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

def subscribe(email)
  check_auth_details!
  request_successful?( post("/subscribe", {:email => email}, @auth) )
end