smsme 0.0.1
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 +7 -0
- data/.gitignore +9 -0
- data/Gemfile +4 -0
- data/LICENSE +7 -0
- data/README.md +69 -0
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/setup +7 -0
- data/lib/smsme.rb +5 -0
- data/lib/smsme/api.rb +55 -0
- data/lib/smsme/core/balance.rb +15 -0
- data/lib/smsme/core/pricing.rb +15 -0
- data/lib/smsme/core/reports.rb +21 -0
- data/lib/smsme/core/send.rb +21 -0
- data/lib/smsme/core/send_bulk.rb +21 -0
- data/lib/smsme/version.rb +4 -0
- data/smsme-api-ruby-client.gemspec +25 -0
- metadata +101 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: f4b4e60881bf52864c54ab8e98660a1f9c9e08f3
|
|
4
|
+
data.tar.gz: 84e39b028a89ef0a7e24b5c4ba1c120ac2ab4460
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: e37132788c330081caa9a76a43cd2c839a7d122dbb35d608e2d0583582dd2da324cd0813630eb29828c23c92ee280d4765b6349c2d17dde88af314482ab5eee9
|
|
7
|
+
data.tar.gz: ffe9022ca8adbae1c260972b28a76d3b5332cd16a193f5468672c87e1347126ed9e134e20f8a437ac405619e883cbd43822e78aff181b3221d1ce7e2a1ac92f6
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright (c) 2016 Dimitris Krestos
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
4
|
+
|
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
|
+
|
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
**This project is under development.**
|
|
2
|
+
|
|
3
|
+
# SMSme
|
|
4
|
+
|
|
5
|
+
A Ruby API library for the SMSme platform.
|
|
6
|
+
|
|
7
|
+
## Getting started
|
|
8
|
+
|
|
9
|
+
Add this line to your application's Gemfile:
|
|
10
|
+
|
|
11
|
+
```ruby
|
|
12
|
+
gem 'smsme'
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
And then execute:
|
|
16
|
+
|
|
17
|
+
$ bundle
|
|
18
|
+
|
|
19
|
+
Or install it yourself as:
|
|
20
|
+
|
|
21
|
+
$ gem install smsme
|
|
22
|
+
|
|
23
|
+
## Usage
|
|
24
|
+
|
|
25
|
+
Create the object:
|
|
26
|
+
|
|
27
|
+
```ruby
|
|
28
|
+
sms = SMSme::Api.new('YOUR_USERNAME', 'YOUR_PASSWORD')
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Get balance
|
|
32
|
+
|
|
33
|
+
```ruby
|
|
34
|
+
sms.balance.data
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Get pricing table
|
|
38
|
+
|
|
39
|
+
```ruby
|
|
40
|
+
sms.pricing.data
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Send a single SMS
|
|
44
|
+
|
|
45
|
+
```ruby
|
|
46
|
+
sms.send.data('originator', 'recipient', 'message', 'delivery_date')
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Send bulk SMS
|
|
50
|
+
|
|
51
|
+
```ruby
|
|
52
|
+
sms.send_bulk.data('originator', 'recipient1, recipient2', 'message', 'delivery_date')
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Get reports
|
|
56
|
+
|
|
57
|
+
```ruby
|
|
58
|
+
sms.reports.data('start_date', 'end_date', 'originator', 'recipient')
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Contributing
|
|
62
|
+
|
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/vdw/smsme-api-ruby-client.
|
|
64
|
+
|
|
65
|
+
## License
|
|
66
|
+
|
|
67
|
+
Released under the MIT License.
|
|
68
|
+
|
|
69
|
+
Copyright 2015 Dimitris Krestos
|
data/Rakefile
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require 'bundler/gem_tasks'
|
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require 'bundler/setup'
|
|
4
|
+
require 'smsme'
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require 'irb'
|
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
data/lib/smsme.rb
ADDED
data/lib/smsme/api.rb
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
require 'smsme/core/balance'
|
|
2
|
+
require 'smsme/core/pricing'
|
|
3
|
+
require 'smsme/core/reports'
|
|
4
|
+
require 'smsme/core/send'
|
|
5
|
+
require 'smsme/core/send_bulk'
|
|
6
|
+
|
|
7
|
+
module SMSme
|
|
8
|
+
|
|
9
|
+
class Api
|
|
10
|
+
attr_accessor :username, :password, :hostname
|
|
11
|
+
|
|
12
|
+
def initialize(username = nil, password = nil, hostname = 'http://webservice.smsme.gr')
|
|
13
|
+
@hostname = hostname || ENV['SMSME_HOSTNAME']
|
|
14
|
+
@username = username || ENV['SMSME_USERNAME']
|
|
15
|
+
@password = password || ENV['SMSME_PASSWORD']
|
|
16
|
+
|
|
17
|
+
raise StandardError, 'You must provide a Smsme username and password' unless @username || @password
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# Makes the requests to api
|
|
21
|
+
def call(path, params = {})
|
|
22
|
+
uri = @hostname + path
|
|
23
|
+
credentials = { 'Username' => @username, 'Password' => @password }
|
|
24
|
+
|
|
25
|
+
response = ::HTTPClient.get uri, params.merge(credentials)
|
|
26
|
+
response.body
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
# Returns the user's credit in euros
|
|
30
|
+
def balance
|
|
31
|
+
Balance.new self
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# Lists pricing tables in euros in xml format
|
|
35
|
+
def pricing
|
|
36
|
+
Pricing.new self
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# Lists all the sending reports for a specific date range
|
|
40
|
+
def reports
|
|
41
|
+
Reports.new self
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
# Sends a sms to a single recipient
|
|
45
|
+
def send
|
|
46
|
+
Send.new self
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# Sned a sms to multiple recipients
|
|
50
|
+
def send_bulk
|
|
51
|
+
SendBulk.new self
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module SMSme
|
|
2
|
+
|
|
3
|
+
class Reports
|
|
4
|
+
attr_accessor :smsme
|
|
5
|
+
|
|
6
|
+
def initialize(smsme)
|
|
7
|
+
@smsme = smsme
|
|
8
|
+
@path = '/Reports.aspx'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def data(start_date = nil, end_date = nil, originator = nil, recipient = nil)
|
|
12
|
+
_params = { 'Sdate' => start_date,
|
|
13
|
+
'Edate' => end_date,
|
|
14
|
+
'Originator' => originator,
|
|
15
|
+
'Mobile' => recipient
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@smsme.call @path, _params
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module SMSme
|
|
2
|
+
|
|
3
|
+
class Send
|
|
4
|
+
attr_accessor :smsme
|
|
5
|
+
|
|
6
|
+
def initialize(smsme)
|
|
7
|
+
@smsme = smsme
|
|
8
|
+
@path = '/SendSmsRequest.aspx'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def data(originator = nil, recipient = nil, message = nil, delivery_date = nil)
|
|
12
|
+
_params = { 'Originator' => originator,
|
|
13
|
+
'Mobile' => recipient,
|
|
14
|
+
'Body' => message,
|
|
15
|
+
'smsDate' => delivery_date
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@smsme.call @path, _params
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
module SMSme
|
|
2
|
+
|
|
3
|
+
class SendBulk
|
|
4
|
+
attr_accessor :smsme
|
|
5
|
+
|
|
6
|
+
def initialize(smsme)
|
|
7
|
+
@smsme = smsme
|
|
8
|
+
@path = '/SendBulkSmsRequest.aspx'
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def data(originator = nil, recipient = nil, message = nil, delivery_date = nil)
|
|
12
|
+
_params = { 'Originator' => originator,
|
|
13
|
+
'Mobile' => recipient,
|
|
14
|
+
'Body' => message,
|
|
15
|
+
'smsDate' => delivery_date
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
@smsme.call @path, _params
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
|
+
require 'smsme/version'
|
|
5
|
+
|
|
6
|
+
Gem::Specification.new do |spec|
|
|
7
|
+
spec.name = 'smsme'
|
|
8
|
+
spec.version = SMSme::VERSION
|
|
9
|
+
spec.authors = ['Dimitris Krestos']
|
|
10
|
+
spec.email = ['dkrestos@gmail.com']
|
|
11
|
+
|
|
12
|
+
spec.summary = 'A Ruby API library for the SMSme platform.'
|
|
13
|
+
spec.description = 'A Ruby API library for the SMSme platform.'
|
|
14
|
+
spec.homepage = 'https://github.com/vdw/smsme-api-ruby-client'
|
|
15
|
+
|
|
16
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
17
|
+
spec.bindir = "exe"
|
|
18
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
19
|
+
spec.require_paths = ['lib']
|
|
20
|
+
|
|
21
|
+
spec.add_development_dependency 'bundler', '~> 1.10'
|
|
22
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
|
23
|
+
|
|
24
|
+
spec.add_dependency 'httpclient', '~> 2.7'
|
|
25
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: smsme
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.0.1
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Dimitris Krestos
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2016-03-21 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: bundler
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - "~>"
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: '1.10'
|
|
20
|
+
type: :development
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - "~>"
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: '1.10'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: rake
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - "~>"
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: '10.0'
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - "~>"
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: '10.0'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: httpclient
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '2.7'
|
|
48
|
+
type: :runtime
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: '2.7'
|
|
55
|
+
description: A Ruby API library for the SMSme platform.
|
|
56
|
+
email:
|
|
57
|
+
- dkrestos@gmail.com
|
|
58
|
+
executables: []
|
|
59
|
+
extensions: []
|
|
60
|
+
extra_rdoc_files: []
|
|
61
|
+
files:
|
|
62
|
+
- ".gitignore"
|
|
63
|
+
- Gemfile
|
|
64
|
+
- LICENSE
|
|
65
|
+
- README.md
|
|
66
|
+
- Rakefile
|
|
67
|
+
- bin/console
|
|
68
|
+
- bin/setup
|
|
69
|
+
- lib/smsme.rb
|
|
70
|
+
- lib/smsme/api.rb
|
|
71
|
+
- lib/smsme/core/balance.rb
|
|
72
|
+
- lib/smsme/core/pricing.rb
|
|
73
|
+
- lib/smsme/core/reports.rb
|
|
74
|
+
- lib/smsme/core/send.rb
|
|
75
|
+
- lib/smsme/core/send_bulk.rb
|
|
76
|
+
- lib/smsme/version.rb
|
|
77
|
+
- smsme-api-ruby-client.gemspec
|
|
78
|
+
homepage: https://github.com/vdw/smsme-api-ruby-client
|
|
79
|
+
licenses: []
|
|
80
|
+
metadata: {}
|
|
81
|
+
post_install_message:
|
|
82
|
+
rdoc_options: []
|
|
83
|
+
require_paths:
|
|
84
|
+
- lib
|
|
85
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - ">="
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '0'
|
|
90
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
91
|
+
requirements:
|
|
92
|
+
- - ">="
|
|
93
|
+
- !ruby/object:Gem::Version
|
|
94
|
+
version: '0'
|
|
95
|
+
requirements: []
|
|
96
|
+
rubyforge_project:
|
|
97
|
+
rubygems_version: 2.4.8
|
|
98
|
+
signing_key:
|
|
99
|
+
specification_version: 4
|
|
100
|
+
summary: A Ruby API library for the SMSme platform.
|
|
101
|
+
test_files: []
|