elk 0.5.1 → 0.6.0

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
- SHA1:
3
- metadata.gz: c66ab0f4764c2d454ca4e118649665e59867067d
4
- data.tar.gz: 469c8c1cd70ba2056a0c60923c1309054249ae57
2
+ SHA256:
3
+ metadata.gz: 8fa0e9357017aa70bd2e10c272d9ad64e9ae25d7ba2b3fba5fb3a29a6057b5a3
4
+ data.tar.gz: 24d637352a8079090e48463fde555b9abff35be7fa38d4df1a6a33b245546219
5
5
  SHA512:
6
- metadata.gz: e8f86119aea25fe735348bba9b15b903f1a876ee4c385c7ab480187c77e3d8064ee993d844890f6d99d527b183f276cde0b2fa66a0d1a0b727900230d49798b1
7
- data.tar.gz: 6b41045238491a46ceae2d5efe1727d24a4d0b0bfe9adb976ab60e965b0d03c1146f227518ef64a1d7823ec2777e50c9dded1f33b293c30690a3c86b3d84b263
6
+ metadata.gz: e87c2960c4442f5956320086581729776523d2d9995f1314dd24c79c89136e5b526c10bc3696b07903cd93216f8b991db00d9334611b92b46e7ec709bb91f2c5
7
+ data.tar.gz: 8804690dc4c494cea3fdba7207c2cc70789a7b55b656df241e2658c13900c6e85b49b3a8ee3ce49b10cb2149beab858475b25dee35d730ef6a02067b98896950
data/README.MD CHANGED
@@ -3,12 +3,12 @@
3
3
  [![Build Status](https://travis-ci.org/jage/elk.svg?branch=master)](https://travis-ci.org/jage/elk)
4
4
  [![Code Climate](https://codeclimate.com/github/jage/elk/badges/gpa.svg)](https://codeclimate.com/github/jage/elk)
5
5
 
6
- Ruby client for 46elks "Voice, SMS & MMS" service. http://46elks.com/
6
+ Ruby client for 46elks "Voice, SMS & MMS" service. https://www.46elks.com/
7
7
  At the moment the API only supports sending SMS messages.
8
8
 
9
9
  ## Requirements
10
10
 
11
- * Modern Ruby: >= 1.9
11
+ * Modern Ruby: >= 2.3
12
12
  * API account at 46elks.com
13
13
 
14
14
  ## Install
@@ -56,7 +56,7 @@ module Elk
56
56
  response.code == 200
57
57
  end
58
58
 
59
- # Deallocates a number, once allocated, a number cannot be used again, ever!
59
+ # Deallocates a number, once deallocated, a number cannot be used again, ever!
60
60
  def deallocate!
61
61
  response = @client.post("/Numbers/#{self.number_id}", { active: "no" })
62
62
  self.set_paramaters(Elk::Util.parse_json(response.body))
@@ -1,3 +1,3 @@
1
1
  module Elk
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -3,7 +3,10 @@ require "elk"
3
3
 
4
4
  describe Elk::Number do
5
5
  before { configure_elk }
6
- let(:url) { "https://USERNAME:PASSWORD@api.46elks.com/a1/Numbers" }
6
+ let(:username) { "USERNAME" }
7
+ let(:password) { "PASSWORD" }
8
+ let(:basic_auth) { [username, password] }
9
+ let(:url) { "https://api.46elks.com/a1/Numbers" }
7
10
 
8
11
  describe ".allocate" do
9
12
  context "swedish sms number" do
@@ -78,16 +81,17 @@ describe Elk::Number do
78
81
  end
79
82
 
80
83
  context "with wrong password" do
81
- let(:url) { "https://USERNAME:WRONG@api.46elks.com/a1/Numbers" }
84
+ let(:url) { "https://api.46elks.com/a1/Numbers" }
85
+ let(:password) { "WRONG" }
82
86
 
83
87
  before(:each) do
84
88
  stub_request(:get, url).
85
- with(headers: get_headers).
89
+ with(headers: get_headers, basic_auth: basic_auth).
86
90
  to_return(fixture('auth_error.txt'))
87
91
 
88
92
  Elk.configure do |config|
89
- config.username = 'USERNAME'
90
- config.password = 'WRONG'
93
+ config.username = username
94
+ config.password = password
91
95
  end
92
96
  end
93
97
 
@@ -116,12 +120,12 @@ describe Elk::Number do
116
120
  describe "#save" do
117
121
  before(:each) do
118
122
  stub_request(:get, url).
119
- with(headers: get_headers).
123
+ with(headers: get_headers, basic_auth: basic_auth).
120
124
  to_return(fixture('gets_allocated_numbers.txt'))
121
125
 
122
126
  stub_request(:post, "#{url}/nea19c8e291676fb7003fa1d63bba7899").
123
- with(body: {"sms_url" => "http://otherhost/receive", "voice_start" => ""},
124
- headers: post_headers).
127
+ with(body: {"sms_url" => "http://otherhost/receive", "voice_start" => nil},
128
+ headers: post_headers, basic_auth: basic_auth).
125
129
  to_return(fixture('updates_a_number.txt'))
126
130
  end
127
131
 
@@ -3,7 +3,11 @@ require "elk"
3
3
 
4
4
  describe Elk::SMS do
5
5
  before { configure_elk }
6
- let(:url) { "https://USERNAME:PASSWORD@api.46elks.com/a1/SMS" }
6
+
7
+ let(:username) { "USERNAME" }
8
+ let(:password) { "PASSWORD" }
9
+ let(:basic_auth) { [username, password] }
10
+ let(:url) { "https://api.46elks.com/a1/SMS" }
7
11
 
8
12
  describe ".send" do
9
13
  let(:from) { "+46761042247" }
@@ -13,7 +17,7 @@ describe Elk::SMS do
13
17
  context "ordinary SMS" do
14
18
  before(:each) do
15
19
  stub_request(:post, url).
16
- with(body: { from: from, message: message, to: to }, headers: post_headers).
20
+ with(body: { from: from, message: message, to: to }, headers: post_headers, basic_auth: basic_auth).
17
21
  to_return(fixture('sends_a_sms.txt'))
18
22
  end
19
23
 
@@ -53,7 +57,8 @@ describe Elk::SMS do
53
57
  before(:each) do
54
58
  @stub = stub_request(:post, url).
55
59
  with(body: { from: from, message: message, to: to, flashsms: "yes" },
56
- headers: post_headers).
60
+ headers: post_headers,
61
+ basic_auth: basic_auth).
57
62
  to_return(fixture('sends_a_sms.txt'))
58
63
  end
59
64
 
@@ -78,7 +83,8 @@ describe Elk::SMS do
78
83
  before do
79
84
  stub_request(:post, url).
80
85
  with(body: { from: from, message: message, to: to.join(",") },
81
- headers: post_headers).
86
+ headers: post_headers,
87
+ basic_auth: basic_auth).
82
88
  to_return(fixture('sends_a_sms_to_multiple_recipients.txt'))
83
89
  end
84
90
 
@@ -226,11 +232,11 @@ describe Elk::SMS do
226
232
  describe "#reload" do
227
233
  before(:each) do
228
234
  stub_request(:get, url).
229
- with(headers: get_headers).
235
+ with(headers: get_headers, basic_auth: basic_auth).
230
236
  to_return(fixture('sms_history.txt'))
231
237
 
232
- stub_request(:get, "https://USERNAME:PASSWORD@api.46elks.com/a1/SMS/s8952031bb83bf3e64f8e13b071c131c0").
233
- with(headers: get_headers).
238
+ stub_request(:get, "https://api.46elks.com/a1/SMS/s8952031bb83bf3e64f8e13b071c131c0").
239
+ with(headers: get_headers, basic_auth: basic_auth).
234
240
  to_return(fixture('reloads_a_sms.txt'))
235
241
  end
236
242
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johan Eckerström
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-12 00:00:00.000000000 Z
11
+ date: 2018-05-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.6'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.6'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '1.0'
61
+ version: '2.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '1.0'
68
+ version: '2.0'
69
69
  description: Elk can be used to allocate a phone numbers, manage the numbers and send
70
70
  SMS through these numbers.
71
71
  email: johan@duh.se
@@ -120,7 +120,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
120
120
  requirements:
121
121
  - - ">="
122
122
  - !ruby/object:Gem::Version
123
- version: 1.9.3
123
+ version: 2.3.0
124
124
  required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
126
  - - ">="
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  requirements:
130
130
  - API account at 46elks.com
131
131
  rubyforge_project:
132
- rubygems_version: 2.4.5.2
132
+ rubygems_version: 2.7.6
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: Client library for 46elks SMS/MMS/Voice service.