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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd31453fcbcb3a4c917dca77ca0b8e3952407d4f1036891658ac6e8c071c1ee9
4
- data.tar.gz: 8f33c69d556fe07454632c5149d7e775bf1604e02795d52d986474dc6d8385f3
3
+ metadata.gz: 56aa0cade898c0945faa7a4db5b1ffe993961790f1da8620ad8f78f931f3bf10
4
+ data.tar.gz: 9f3cb3dc53572c1cd217fe9f2dda5026341f4236955717c03c286ed1385d4b0a
5
5
  SHA512:
6
- metadata.gz: ecd1839c1260f125c896598035175c5ce6c3b3b159e128bea7594c1842aadfd633b8c870012eb16c081e355784bfdf4d644120234562a6e9748a9c80733f88bf
7
- data.tar.gz: 8bd005c31bc2b26fec505235d640a64af90f4db62ea4f1a3cf3f54c6e0d2d3aaa947c955e52088c312146b59700a8fff5da45cf7d5f8b0d1df1186d6b097971a
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 = xml.gsub!(/\s+/, ' ')
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
@@ -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 = phone
8
- @message = message
7
+ @phone = phone
8
+ @message = message
9
9
  @originator = originator || SmsTraffic.configuration.originator
10
- @status = 'not-sent'
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 = reply.sms_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
@@ -1,3 +1,3 @@
1
1
  module SmsTraffic
2
- VERSION = '0.0.2'.freeze
2
+ VERSION = '0.0.4'.freeze
3
3
  end
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.2
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-04 00:00:00.000000000 Z
11
+ date: 2024-10-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri