sms_traffic_sdk 0.0.2 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sms_traffic/client/deliver_reply.rb +3 -1
- data/lib/sms_traffic/client/reply.rb +3 -1
- data/lib/sms_traffic/sms.rb +6 -6
- data/lib/sms_traffic/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 56aa0cade898c0945faa7a4db5b1ffe993961790f1da8620ad8f78f931f3bf10
|
4
|
+
data.tar.gz: 9f3cb3dc53572c1cd217fe9f2dda5026341f4236955717c03c286ed1385d4b0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 670f8dd039cc41234e4a477f1a1ac1007f7fc2374d1823776a5975848910c3cd0c5c087f72a2986e07c3f81bae579a3d670548bc8f872e5eb5bde90933c0bf1e
|
7
|
+
data.tar.gz: 61599f0d3633bf2a2220a662de705888beb20e535e722627f709cf18380a7859b256e619afdab615f86cbdd24c19ad5386dc559255a64043bf09e77acbd362af
|
@@ -5,6 +5,8 @@ module SmsTraffic
|
|
5
5
|
|
6
6
|
def ok?
|
7
7
|
fetch_value(hash, :result) == OK_REPLY
|
8
|
+
rescue NoMethodError
|
9
|
+
false
|
8
10
|
end
|
9
11
|
|
10
12
|
def error?
|
@@ -29,7 +31,7 @@ module SmsTraffic
|
|
29
31
|
|
30
32
|
def sms_id(phone = nil)
|
31
33
|
message_info = fetch_value(message_infos, :message_info)
|
32
|
-
return fetch_value(message_info, :sms_id) if message_info.is_a?(Hash)
|
34
|
+
return fetch_value(message_info, :sms_id) if message_info.is_a?(Hash) || message_info.nil?
|
33
35
|
|
34
36
|
raise ArgumentError, 'phone is required' unless phone
|
35
37
|
|
@@ -4,7 +4,7 @@ module SmsTraffic
|
|
4
4
|
attr_reader :xml, :hash
|
5
5
|
|
6
6
|
def initialize(xml, xml_parser: SmsTraffic.configuration.xml_parser)
|
7
|
-
@xml
|
7
|
+
@xml = xml.gsub!(/\s+/, ' ')
|
8
8
|
@hash = fetch_value(xml_parser.parse(xml), :reply)
|
9
9
|
end
|
10
10
|
|
@@ -12,6 +12,8 @@ module SmsTraffic
|
|
12
12
|
|
13
13
|
def fetch_value(hash, key)
|
14
14
|
hash.fetch(key.to_s, nil) || hash.fetch(key.to_sym, nil)
|
15
|
+
rescue NoMethodError
|
16
|
+
nil
|
15
17
|
end
|
16
18
|
end
|
17
19
|
end
|
data/lib/sms_traffic/sms.rb
CHANGED
@@ -4,11 +4,11 @@ module SmsTraffic
|
|
4
4
|
attr_reader :id, :status, :errors
|
5
5
|
|
6
6
|
def initialize(phone, message, originator: nil)
|
7
|
-
@phone
|
8
|
-
@message
|
7
|
+
@phone = phone
|
8
|
+
@message = message
|
9
9
|
@originator = originator || SmsTraffic.configuration.originator
|
10
|
-
@status
|
11
|
-
@errors
|
10
|
+
@status = 'not-sent'
|
11
|
+
@errors = []
|
12
12
|
validate!
|
13
13
|
end
|
14
14
|
|
@@ -26,10 +26,10 @@ module SmsTraffic
|
|
26
26
|
|
27
27
|
if reply.ok?
|
28
28
|
@status = 'sent'
|
29
|
-
@id
|
29
|
+
@id = reply.sms_id(phone)
|
30
30
|
true
|
31
31
|
else
|
32
|
-
@errors << reply.error_description
|
32
|
+
@errors << (reply.error_description || 'Sms has been not enqueued')
|
33
33
|
false
|
34
34
|
end
|
35
35
|
end
|
data/lib/sms_traffic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sms_traffic_sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Rybolovlev
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-09
|
11
|
+
date: 2024-10-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: nokogiri
|