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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 49cfd8e8a80bbdb69d7e5fcb96f68f26f8bf00fd
4
- data.tar.gz: f8220412d6aefee9cf9a6c492ac3f470687060a6
3
+ metadata.gz: 6dd64ed6fd24d533cd3173993019f3c963db5be4
4
+ data.tar.gz: 94efd21275a9b4a9e375d36ce8bfdf08e728b96b
5
5
  SHA512:
6
- metadata.gz: 331aebfec69d5d47721b42d4871470a75973d3c5d1bddd76a0ec44e88fd38848e910de74d8863730642f453565730a020625693a36015b69984ee2476a0fd1a6
7
- data.tar.gz: cf9e4a602dca9c91955cbda5766aad5e6ec6f029f0419f9abe1e23dc5c10d6d3fc0b94a6127054e741c026e19f2d73e22d44ceab89b5c174de12e6be62f97d20
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.
@@ -1,3 +1,3 @@
1
1
  module SmsApi
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
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
- get('/sms.do', query: { to: to, test: 1, message: text})
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
- # def self.status
16
- # #method will give status of last message
17
- # puts 'Method to recive status'
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pjit-sms_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Piotr Jarosz