Class: Serwersms
- Inherits:
-
Object
- Object
- Serwersms
- Defined in:
- lib/serwersms.rb
Defined Under Namespace
Classes: Accounts, Blacklist, Contacts, Error, Files, Groups, Messages, Payments, Phones, Premium, Senders, Stats, Subaccounts, Templates
Constant Summary collapse
- @@api_url =
'http://api2.serwersms.pl/'- @@system =
'client_ruby'
Instance Attribute Summary collapse
-
#accounts ⇒ Object
Returns the value of attribute accounts.
-
#blacklist ⇒ Object
Returns the value of attribute blacklist.
-
#contacts ⇒ Object
Returns the value of attribute contacts.
-
#error ⇒ Object
Returns the value of attribute error.
-
#files ⇒ Object
Returns the value of attribute files.
-
#groups ⇒ Object
Returns the value of attribute groups.
-
#messages ⇒ Object
Returns the value of attribute messages.
-
#payments ⇒ Object
Returns the value of attribute payments.
-
#phones ⇒ Object
Returns the value of attribute phones.
-
#premium ⇒ Object
Returns the value of attribute premium.
-
#senders ⇒ Object
Returns the value of attribute senders.
-
#stats ⇒ Object
Returns the value of attribute stats.
-
#subaccounts ⇒ Object
Returns the value of attribute subaccounts.
-
#templates ⇒ Object
Returns the value of attribute templates.
Instance Method Summary collapse
- #call(url, params = {}) ⇒ Object
-
#initialize(username, password) ⇒ Serwersms
constructor
A new instance of Serwersms.
Constructor Details
#initialize(username, password) ⇒ Serwersms
Returns a new instance of Serwersms.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/serwersms.rb', line 21 def initialize(username, password) @username = username @password = password @messages = Messages.new(self) @files = Files.new(self) @premium = Premium.new(self) @accounts = Accounts.new(self) @senders = Senders.new(self) @groups = Groups.new(self) @contacts = Contacts.new(self) @phones = Phones.new(self) @subaccounts = Subaccounts.new(self) @blacklist = Blacklist.new(self) @payments = Payments.new(self) @stats = Stats.new(self) @templates = Templates.new(self) @error = Error.new(self) end |
Instance Attribute Details
#accounts ⇒ Object
Returns the value of attribute accounts.
9 10 11 |
# File 'lib/serwersms.rb', line 9 def accounts @accounts end |
#blacklist ⇒ Object
Returns the value of attribute blacklist.
15 16 17 |
# File 'lib/serwersms.rb', line 15 def blacklist @blacklist end |
#contacts ⇒ Object
Returns the value of attribute contacts.
12 13 14 |
# File 'lib/serwersms.rb', line 12 def contacts @contacts end |
#error ⇒ Object
Returns the value of attribute error.
19 20 21 |
# File 'lib/serwersms.rb', line 19 def error @error end |
#files ⇒ Object
Returns the value of attribute files.
7 8 9 |
# File 'lib/serwersms.rb', line 7 def files @files end |
#groups ⇒ Object
Returns the value of attribute groups.
11 12 13 |
# File 'lib/serwersms.rb', line 11 def groups @groups end |
#messages ⇒ Object
Returns the value of attribute messages.
6 7 8 |
# File 'lib/serwersms.rb', line 6 def @messages end |
#payments ⇒ Object
Returns the value of attribute payments.
16 17 18 |
# File 'lib/serwersms.rb', line 16 def payments @payments end |
#phones ⇒ Object
Returns the value of attribute phones.
13 14 15 |
# File 'lib/serwersms.rb', line 13 def phones @phones end |
#premium ⇒ Object
Returns the value of attribute premium.
8 9 10 |
# File 'lib/serwersms.rb', line 8 def premium @premium end |
#senders ⇒ Object
Returns the value of attribute senders.
10 11 12 |
# File 'lib/serwersms.rb', line 10 def senders @senders end |
#stats ⇒ Object
Returns the value of attribute stats.
17 18 19 |
# File 'lib/serwersms.rb', line 17 def stats @stats end |
#subaccounts ⇒ Object
Returns the value of attribute subaccounts.
14 15 16 |
# File 'lib/serwersms.rb', line 14 def subaccounts @subaccounts end |
#templates ⇒ Object
Returns the value of attribute templates.
18 19 20 |
# File 'lib/serwersms.rb', line 18 def templates @templates end |
Instance Method Details
#call(url, params = {}) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/serwersms.rb', line 40 def call(url, params = {}) uri = URI.parse(@@api_url+url) https = Net::HTTP.new(uri.host,uri.port) req = Net::HTTP::Post.new(uri.path,{'Content-Type' => 'application/json'}) params['username'] = @username params['password'] = @password params['system'] = @@system req.body = params.to_json res = https.request(req) return res.body end |