globelabs_sms_logger 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/globelabs_sms/logger.rb +6 -2
- data/lib/globelabs_sms_logger/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bea4847a984e5899891cd75591642752d512058f7d9ce2f4a5d42326ade0e4cb
|
4
|
+
data.tar.gz: 4c39cecefb4f02fed78d7a33ec0f56804bfd70cf3f0a4d6b07df2c96dade5db9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 258f038eb034661afa67f02ed7a4abf9855fbc3c14c7b7891b4b72a9186057b5be1822a0378e177fa92f903903d1dd953d51bae32f28dbe1761d38b8da7a5b49
|
7
|
+
data.tar.gz: 3c0cdb5250bfef782bb28eefc504553ba8aae45e6c7dccb8981692632ca19d2d5e44f9c80215e992a2819a1c1173f3ef90af9cc51077574f2c71a2f3d504555d
|
data/lib/globelabs_sms/logger.rb
CHANGED
@@ -5,11 +5,14 @@ require 'json'
|
|
5
5
|
class GlobelabsSms
|
6
6
|
# Class
|
7
7
|
class Logger
|
8
|
-
attr_accessor :api_token, :identifier, :host, :address, :content
|
8
|
+
attr_accessor :api_token, :identifier, :host, :address, :content, :group
|
9
9
|
|
10
10
|
ENDPOINT = '/api/v1/messages'.freeze
|
11
11
|
|
12
12
|
def initialize(opts = {})
|
13
|
+
@address = opts[:address]
|
14
|
+
@content = opts[:content]
|
15
|
+
@group = opts[:group]
|
13
16
|
@host = GlobelabsSmsLogger.configuration.host
|
14
17
|
@api_token = opts.fetch(:api_token,
|
15
18
|
GlobelabsSmsLogger.configuration.api_token)
|
@@ -20,6 +23,7 @@ class GlobelabsSms
|
|
20
23
|
def send(opts = {})
|
21
24
|
@address = opts.fetch(:address, address)
|
22
25
|
@content = opts.fetch(:content, content)
|
26
|
+
@group = opts.fetch(:group, group)
|
23
27
|
|
24
28
|
perform_sending
|
25
29
|
end
|
@@ -31,7 +35,7 @@ class GlobelabsSms
|
|
31
35
|
req = Net::HTTP::Post.new(uri.path)
|
32
36
|
req['Gem-Version'] = GlobelabsSmsLogger::VERSION
|
33
37
|
req.basic_auth(identifier, api_token)
|
34
|
-
req.set_form_data(content: content, address: address)
|
38
|
+
req.set_form_data(content: content, address: address, group: group)
|
35
39
|
res = Net::HTTP.start(uri.host, uri.port,
|
36
40
|
use_ssl: uri.scheme == 'https') do |http|
|
37
41
|
http.request(req)
|