mprofi_api_client 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/LICENSE +7 -7
- data/README.md +12 -8
- data/lib/mprofi_api_client/connector.rb +6 -1
- data/lib/mprofi_api_client.rb +1 -1
- data/mprofi_api_client.gemspec +4 -4
- metadata +5 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9fc957c0eb9e44d069f8c3d1a8744c3837b658a83cca01b8ac83932058fc092d
|
4
|
+
data.tar.gz: a5e49744b9e0a5d1d84133322d4404e07b67bdf5d80587eb5180ef4313230f2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9201e0b067e2252702d3bfa42a3bb2fcec860a457108449d09ba414f43304fd4b99ef31ff428a0f13f7482cc08b640d9e5058415bf5a5b404b508435b872eb79
|
7
|
+
data.tar.gz: af5aa7cd39c8814a8e500c6a9cf1088f6184af484d9a9b8dbe692e2772edca1e1f7f5992de78282e50dfa2efa7592bc850727cf1d6d1069d3ce31c0070cadb42
|
data/LICENSE
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
Copyright (c) 2015,
|
1
|
+
Copyright (c) 2015, COMVERGA Sp. z o. o.
|
2
2
|
All rights reserved.
|
3
3
|
|
4
4
|
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
5
|
|
6
6
|
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
7
|
|
8
|
-
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
8
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the
|
9
9
|
documentation and/or other materials provided with the distribution.
|
10
10
|
|
11
|
-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
12
|
-
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
13
|
-
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
14
|
-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
15
|
-
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
11
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
|
12
|
+
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
|
13
|
+
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
14
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
15
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
16
16
|
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
[![Gem Version](https://badge.fury.io/rb/mprofi_api_client.svg)](http://badge.fury.io/rb/mprofi_api_client)
|
1
2
|
|
2
3
|
# Mprofi API connector
|
3
4
|
|
@@ -13,17 +14,17 @@ gem 'mprofi_api_client'
|
|
13
14
|
|
14
15
|
# or
|
15
16
|
|
16
|
-
gem 'mprofi_api_client', :git => 'https://github.com/
|
17
|
+
gem 'mprofi_api_client', :git => 'https://github.com/comverga/mprofi_api_client_ruby.git'
|
17
18
|
|
18
19
|
```
|
19
20
|
|
20
21
|
### From github.com
|
21
22
|
|
22
23
|
```bash
|
23
|
-
git clone https://github.com/
|
24
|
+
git clone https://github.com/comverga/mprofi_api_client_ruby.git
|
24
25
|
cd mprofi_api_client_ruby
|
25
26
|
rake build
|
26
|
-
gem install mprofi_api_client-0.1.
|
27
|
+
gem install mprofi_api_client-0.1.1.gem
|
27
28
|
```
|
28
29
|
|
29
30
|
# Usage
|
@@ -38,13 +39,16 @@ connector = MprofiApiClient::Connector.new(API_TOKEN)
|
|
38
39
|
# connector = MprofiApiClient::Connector.new(API_TOKEN, 'http://your_proxy_host_address:8080/')
|
39
40
|
begin
|
40
41
|
connector.add_message('501002003', 'Test message 1', 'your-msg-id-001')
|
41
|
-
|
42
|
-
|
43
|
-
#
|
42
|
+
# message with Polish diacritics
|
43
|
+
connector.add_message('601002003', 'Test message ąćęłńóśźż', 'your-msg-id-002', encoding: 'utf-8')
|
44
|
+
# scheduled message
|
45
|
+
connector.add_message('701002003', 'Test message 3', 'your-msg-id-003', date: '2022-08-30T12:00:00+02:00')
|
46
|
+
result = connector.send
|
47
|
+
# => [{"id"=>58},{"id"=>59},{"id"=>60}]
|
44
48
|
|
45
49
|
result.each do |r|
|
46
50
|
status = connector.get_status(r['id'])
|
47
|
-
# => {"status"=>"delivered", "id"=>
|
51
|
+
# => {"status"=>"delivered", "id"=>58, "reference"=>"your-msg-id-001", "ts"=>"2015-03-26T10:55:06.098Z"}
|
48
52
|
|
49
53
|
# do sth with status
|
50
54
|
end
|
@@ -59,4 +63,4 @@ end
|
|
59
63
|
|
60
64
|
## Copyright
|
61
65
|
|
62
|
-
Copyright (c) 2015
|
66
|
+
Copyright (c) 2015 COMVERGA Sp. z o. o. See LICENSE for details.
|
@@ -33,12 +33,17 @@ module MprofiApiClient
|
|
33
33
|
# +recipient+:: Message recipient as string (phone number format: XXXXXXXXX f.e. 664400100).
|
34
34
|
# +message+:: Message content as string.
|
35
35
|
# +reference+:: Client message ID defined by user for message tracking. (optional)
|
36
|
-
|
36
|
+
# +options+:: Message options: encoding (default: {}):
|
37
|
+
# +:encoding+ - set to 'utf-8' if you need special characters (diacritical marks, emoji),
|
38
|
+
# +:date+ - time the message will be sent (accepted formats: ISO-8601, unix epoch)
|
39
|
+
def add_message(recipient, message, reference = nil, options = {})
|
37
40
|
raise ArgumentError, "`recipient` cannot be empty" if recipient.nil? || recipient.empty?
|
38
41
|
raise ArgumentError, "`message` cannot be empty" if message.nil? || message.empty?
|
39
42
|
|
40
43
|
message = { 'recipient' => recipient, 'message' => message }
|
41
44
|
message['reference'] = reference if reference
|
45
|
+
message['encoding'] = options[:encoding] if options.key?(:encoding)
|
46
|
+
message['date'] = options[:date] if options.key?(:date)
|
42
47
|
|
43
48
|
@messages << message
|
44
49
|
end
|
data/lib/mprofi_api_client.rb
CHANGED
data/mprofi_api_client.gemspec
CHANGED
@@ -8,10 +8,10 @@ Gem::Specification.new do |spec|
|
|
8
8
|
|
9
9
|
spec.summary = 'MProfi API client library'
|
10
10
|
spec.date = '2015-03-05'
|
11
|
-
spec.authors = ['
|
12
|
-
|
13
|
-
spec.email = '
|
14
|
-
spec.homepage = 'https://github.com/
|
11
|
+
spec.authors = ['COMVERGA Sp. z o. o.']
|
12
|
+
|
13
|
+
spec.email = 'pomoc@mprofi.pl'
|
14
|
+
spec.homepage = 'https://github.com/comverga/mprofi_api_client_ruby'
|
15
15
|
spec.description = spec.summary
|
16
16
|
spec.license = 'BSD'
|
17
17
|
|
metadata
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mprofi_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- COMVERGA Sp. z o. o.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
@@ -81,7 +81,7 @@ dependencies:
|
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
description: MProfi API client library
|
84
|
-
email:
|
84
|
+
email: pomoc@mprofi.pl
|
85
85
|
executables: []
|
86
86
|
extensions: []
|
87
87
|
extra_rdoc_files: []
|
@@ -94,7 +94,7 @@ files:
|
|
94
94
|
- lib/mprofi_api_client/connector.rb
|
95
95
|
- lib/mprofi_api_client/connector_exception.rb
|
96
96
|
- mprofi_api_client.gemspec
|
97
|
-
homepage: https://github.com/
|
97
|
+
homepage: https://github.com/comverga/mprofi_api_client_ruby
|
98
98
|
licenses:
|
99
99
|
- BSD
|
100
100
|
metadata: {}
|
@@ -113,8 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
113
113
|
- !ruby/object:Gem::Version
|
114
114
|
version: '0'
|
115
115
|
requirements: []
|
116
|
-
|
117
|
-
rubygems_version: 2.4.6
|
116
|
+
rubygems_version: 3.3.7
|
118
117
|
signing_key:
|
119
118
|
specification_version: 4
|
120
119
|
summary: MProfi API client library
|