sms-pilot-api-v1 0.0.5 → 0.0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2f18c87d0d06449a2d1990eefe98e92a66e2e543e6d37cadb8a59597fb165232
4
- data.tar.gz: 27b96c2afab4411c63474d807692336d32e95196d1172114f5ffaf9ddbb6d650
3
+ metadata.gz: ef5f991fb1af59f48bbc7ccab3e1ab3b417c76fc22a584922fa5bca8879e294c
4
+ data.tar.gz: 83031cf779a24ed4b1d44de6d08f33ef611a0b9fdc63742c14ec792080c54fa5
5
5
  SHA512:
6
- metadata.gz: 5f59608daac142c675c71485c2ab63fa0a1291ebecc887f939a3a272d586a806f8cea5068174064ba9ff193172f0975836512136ac3a75f7b843f3afb1ab113e
7
- data.tar.gz: 9aeae9908fd518c5156b472f27c618f57c48d1370e09a2ffa8ab40430c083a908bc684fc15e3a1e76397f1d47b66c4c43c7c87da0fa89651a7006e5210317ddd
6
+ metadata.gz: 84a60a7e124256682fd89d4d411c7402feb6597b0541493c2bd08b88b95a515cdf4ae9c0fb435939d7b6f98a56b2d9dd513cd344023bb2f446fbcffc8507eac0
7
+ data.tar.gz: d0a91bb376ef6090356040cc8eddca2272ce1917e044a7a7cea43f6fe812d265ea1c548eb63e95b5c163a1baed78758bb35a5a0075dea096674bbd4649f0a4ab
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.6] - 9 May 2021
4
+
5
+ - Corrects cost type
6
+ - Switches to PRY in console
7
+
8
+ ## [0.0.5] - 9 May 2021
9
+
10
+ - Adds locale support (RU / EN)
11
+
3
12
  ## [0.0.4] - 9 May 2021
4
13
 
5
14
  - Drop dependence on HTTP.rb gem
data/Gemfile CHANGED
@@ -5,5 +5,6 @@ source "https://rubygems.org"
5
5
  # Specify your gem's dependencies in gemspec
6
6
  gemspec
7
7
 
8
+ gem "pry"
8
9
  gem "rake", "~> 13.0"
9
10
  gem "rspec", "~> 3.0"
data/Gemfile.lock CHANGED
@@ -1,12 +1,17 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sms-pilot-api-v1 (0.0.3)
4
+ sms-pilot-api-v1 (0.0.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
8
8
  specs:
9
+ coderay (1.1.3)
9
10
  diff-lcs (1.4.4)
11
+ method_source (1.0.0)
12
+ pry (0.14.1)
13
+ coderay (~> 1.1)
14
+ method_source (~> 1.0)
10
15
  rake (13.0.3)
11
16
  rspec (3.10.0)
12
17
  rspec-core (~> 3.10.0)
@@ -26,6 +31,7 @@ PLATFORMS
26
31
  x86_64-darwin-17
27
32
 
28
33
  DEPENDENCIES
34
+ pry
29
35
  rake (~> 13.0)
30
36
  rspec (~> 3.0)
31
37
  sms-pilot-api-v1!
data/README.md CHANGED
@@ -18,7 +18,7 @@ from GitHub:
18
18
  gem "sms-pilot-api-v1", git: "https://github.com/sergeypedan/sms-pilot-api-v1.git"
19
19
  ```
20
20
 
21
- ## Usage
21
+ ## Playground
22
22
 
23
23
  Test sending SMS from console with a test API key (find it at the end of this page):
24
24
 
@@ -27,14 +27,18 @@ cd $(bundle info sms-pilot-api-v1 --path)
27
27
  bin/console
28
28
  ```
29
29
 
30
+
31
+ ## Usage
32
+
30
33
  ### Initialize
31
34
 
32
35
  ```ruby
33
36
  require "sms_pilot"
34
37
 
35
- client = SmsPilot::Client.new(api_key: "XXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZ")
36
- client = SmsPilot::Client.new(api_key: "XXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZ", locale: :en) # Available locales are [:en, :ru]
37
- #<SmsPilot::Client:0x00007fb1c602d490 @api_key="XXXXX...", @error=nil, @response_status=nil, @response_headers=nil, @response_body=nil, @response_data={}, @url=nil>
38
+ key = "XXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZ"
39
+
40
+ client = SmsPilot::Client.new(api_key: key)
41
+ client = SmsPilot::Client.new(api_key: key, locale: :en) # Available locales are [:en, :ru]
38
42
  ```
39
43
 
40
44
  ### Before sending
@@ -59,7 +63,8 @@ client.url # => nil
59
63
  ### Sending SMS
60
64
 
61
65
  ```ruby
62
- client.send_sms("+7 (902) 123-45-67", "Привет, мир!") # => true
66
+ client.send_sms("+7 (902) 123-45-67", "Привет, мир!")
67
+ # => true
63
68
  ```
64
69
 
65
70
  Returns result of `sms_sent?`, so it’s either `true` or `false`.
data/bin/console CHANGED
@@ -8,8 +8,5 @@ require "sms_pilot"
8
8
  # with your gem easier. You can also use a different console, if you like.
9
9
 
10
10
  # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require "irb"
15
- IRB.start(__FILE__)
11
+ require "pry"
12
+ Pry.start
@@ -101,14 +101,19 @@ module SmsPilot
101
101
 
102
102
 
103
103
  # @param api_key [String]
104
+ # @param locale [Symbol]
105
+ #
104
106
  # @return [SmsPilot::Client]
105
107
  # @raise [SmsPilot::InvalidAPIkeyError] if you pass anything but a non-empty String
108
+ # @raise [SmsPilot::InvalidLocaleError] if you pass anything but <tt>:ru</tt> or <tt>:en</tt>
109
+ #
106
110
  # @see https://smspilot.ru/my-settings.php Get your production API key here
107
111
  # @see https://smspilot.ru/apikey.php Get your development API key here
108
112
  # @note Current development API key is <tt>"XXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZXXXXXXXXXXXXYYYYYYYYYYYYZZZZZZZZ"</tt>
109
113
  #
110
114
  # @example
111
115
  # client = SmsPilot::Client.new(api_key: ENV["SMS_PILOT_API_KEY"])
116
+ # client = SmsPilot::Client.new(api_key: ENV["SMS_PILOT_API_KEY"], locale: :en)
112
117
  #
113
118
  def initialize(api_key:, locale: AVAILABLE_LOCALES[0])
114
119
  @api_key = validate_api_key!(api_key)
@@ -263,7 +268,7 @@ module SmsPilot
263
268
  # client.sms_cost #=> 2.63
264
269
  #
265
270
  def sms_cost
266
- @response_data["cost"] if sms_sent?
271
+ @response_data["cost"]&.to_f if sms_sent?
267
272
  end
268
273
 
269
274
 
@@ -3,6 +3,6 @@
3
3
  module SmsPilot
4
4
 
5
5
  # Gem version
6
- VERSION = "0.0.5"
6
+ VERSION = "0.0.6"
7
7
 
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sms-pilot-api-v1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Pedan