Class: SendHub

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/ruby-sendhub.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil, number = nil) ⇒ SendHub

Returns a new instance of SendHub.



12
13
14
15
# File 'lib/ruby-sendhub.rb', line 12

def initialize(api_key = nil, number = nil)
	@number = number
	@api_key = api_key
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



8
9
10
# File 'lib/ruby-sendhub.rb', line 8

def api_key
  @api_key
end

#numberObject

Returns the value of attribute number.



8
9
10
# File 'lib/ruby-sendhub.rb', line 8

def number
  @number
end

Instance Method Details

#get_contactsObject



17
18
19
20
# File 'lib/ruby-sendhub.rb', line 17

def get_contacts
	c = self.class.get base_url + "contacts" + credentials
	c.parsed_response['objects']
end

#send_message(message, *args) ⇒ Object



22
23
24
25
26
# File 'lib/ruby-sendhub.rb', line 22

def send_message(message, *args)
	api_url = base_url + "messages" + credentials
	m = { :contacts => args, :text => message }
	self.class.post(api_url, :body => m.to_json)
end