pjit-sms_api 0.0.2 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -0
- data/lib/sms_api/version.rb +1 -1
- data/lib/sms_api.rb +25 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6dd64ed6fd24d533cd3173993019f3c963db5be4
|
4
|
+
data.tar.gz: 94efd21275a9b4a9e375d36ce8bfdf08e728b96b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a937391a03d6962ddf3fb84e353514eae59d4fabc9d73ad42e64f9f641c8bcfc6865d48d62b1e5eefbd2fb332709a46066c7b5532fd7b06e442bb4005b8b60ad
|
7
|
+
data.tar.gz: 6cf99a4fac0ae481822809c67e4f637f751048f2ea201c0eeb0009e6b4408a3f777fab451a4776163c00719b61ec15eb479be58b50b8af6bdb57269f0b483e11
|
data/README.md
CHANGED
@@ -26,8 +26,17 @@ First of all you need to set environment variables:
|
|
26
26
|
* SMSAPI_USERNAME with smsapi.pl username
|
27
27
|
* SMSAPI_MD5 with MD5 of smsapi.pl password
|
28
28
|
|
29
|
+
If you want to use gem in test mode, you net to set SMSAPI_TEST environment variable to 1
|
30
|
+
|
29
31
|
Then you can use by passing SmsApi.send('[phone number]', '[message]')
|
30
32
|
|
33
|
+
For account status you can use SmsApi.status
|
34
|
+
In case you need specified value you can use as follows:
|
35
|
+
* SmsApi.status['points'] - for points count
|
36
|
+
* SmsApi.status['proCount'] - for pro messages count
|
37
|
+
* SmsApi.status['ecoCount'] - for default messages count
|
38
|
+
* SmsApi.status['mmsCount'] - for MMS count
|
39
|
+
|
31
40
|
## Development
|
32
41
|
|
33
42
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
data/lib/sms_api/version.rb
CHANGED
data/lib/sms_api.rb
CHANGED
@@ -5,15 +5,35 @@ module SmsApi
|
|
5
5
|
include HTTParty
|
6
6
|
base_uri 'https://api.smsapi.pl'
|
7
7
|
default_params username: ENV['SMSAPI_USERNAME'], password: ENV['SMSAPI_MD5'],
|
8
|
-
format: 'json'
|
8
|
+
format: 'json'#, test: test
|
9
9
|
format :json
|
10
10
|
|
11
11
|
def self.send to, text
|
12
|
-
|
12
|
+
##
|
13
|
+
# Method to send ECO messages
|
14
|
+
# usage: SmsApi.send('MSISDN','message')
|
15
|
+
# Some details about response
|
16
|
+
# In response you will recive ['count'] of sended messages,
|
17
|
+
# ['list'] of messages, on list you have some extra data:
|
18
|
+
# "id" - message id, You can use it to grab message status,
|
19
|
+
# "points" - cost of operation, "error" - error code if will ocure
|
20
|
+
test = ENV['SMSAPI_TEST'] || 0
|
21
|
+
get('/sms.do', query: { to: to, test: test, message: text})
|
13
22
|
end
|
14
23
|
|
15
|
-
|
16
|
-
|
17
|
-
|
24
|
+
def self.status
|
25
|
+
##
|
26
|
+
# Method will give count avaliable count/messages on account
|
27
|
+
# In case you need specified value you can use as follows:
|
28
|
+
# SmsApi.status['points'] - for points count
|
29
|
+
# SmsApi.status['proCount'] - for pro messages count
|
30
|
+
# SmsApi.status['ecoCount'] - for default messages count
|
31
|
+
# SmsApi.status['mmsCount'] - for MMS count
|
32
|
+
|
33
|
+
get('/user.do', query: { credits: 1, details: 1})
|
34
|
+
end
|
35
|
+
|
36
|
+
# def self.mstatus
|
37
|
+
|
18
38
|
# end
|
19
39
|
end
|