Class: SendHub
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#number ⇒ Object
Returns the value of attribute number.
Instance Method Summary collapse
- #get_contacts ⇒ Object
-
#initialize(api_key = nil, number = nil) ⇒ SendHub
constructor
A new instance of SendHub.
- #send_message(message, *args) ⇒ Object
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_key ⇒ Object
Returns the value of attribute api_key.
8 9 10 |
# File 'lib/ruby-sendhub.rb', line 8 def api_key @api_key end |
#number ⇒ Object
Returns the value of attribute number.
8 9 10 |
# File 'lib/ruby-sendhub.rb', line 8 def number @number end |
Instance Method Details
#get_contacts ⇒ Object
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 (, *args) api_url = base_url + "messages" + credentials m = { :contacts => args, :text => } self.class.post(api_url, :body => m.to_json) end |