revere_mobile 0.1.0 → 0.1.1
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 +4 -4
- data/README.md +3 -1
- data/lib/revere_mobile/client/authentication.rb +13 -3
- data/lib/revere_mobile/configuration.rb +1 -1
- data/lib/revere_mobile/connection.rb +3 -4
- data/lib/revere_mobile/version.rb +1 -1
- data/spec/revere_mobile/revere_mobile_spec.rb +1 -1
- data/spec/spec_helper.rb +4 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da977da2155a9df2f3118822e2aa328a0e9c6f3f
|
4
|
+
data.tar.gz: b144d93bd0509c5ec0b6771d690199b5cfbcf8d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: baf328052e4a8753d91cef1f8f1a2ac46dbf8a97a6986a1a48bd4e5870da7a667530728f5bf0d51b9f3f216e0948b588b916db828f276c77b5d086b412ff5446
|
7
|
+
data.tar.gz: b1df1ccaa970bd65d9414edcde63bce2ab1a762c6a0e85b3aa4e6138b95bd8921a3c763963b190dfbb8b171ad89fe7c6c8fff4730a53c3feb36e8dfba7b4f342
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# The Revere Mobile Ruby Gem
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/revolution-messaging/revere_mobile_ruby_client)
|
5
|
+
[](https://badge.fury.io/rb/revere_mobile)
|
4
6
|
|
5
7
|
# Quick Start
|
6
8
|
|
@@ -1,18 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'faraday-cookie_jar'
|
4
|
+
require 'awesome_print'
|
4
5
|
|
5
6
|
module RevereMobile
|
6
7
|
class Client
|
7
8
|
module Authentication
|
8
9
|
def login
|
9
|
-
|
10
|
+
|
11
|
+
temp_cookie_jar = HTTP::CookieJar.new
|
12
|
+
|
13
|
+
conn = Faraday.new(url: config.api_endpoint) do |f|
|
14
|
+
f.use :cookie_jar, jar: temp_cookie_jar
|
15
|
+
f.adapter Faraday.default_adapter
|
16
|
+
end
|
17
|
+
|
10
18
|
response = conn.post do |req|
|
11
|
-
req.url '
|
19
|
+
req.url 'authenticate'
|
12
20
|
req.headers['Content-Type'] = 'application/json'
|
13
21
|
req.body = JSON.generate({ username: config.username, password: config.password })
|
14
22
|
end
|
15
|
-
|
23
|
+
|
24
|
+
|
25
|
+
config.session = temp_cookie_jar
|
16
26
|
response
|
17
27
|
end
|
18
28
|
|
@@ -13,15 +13,14 @@ module RevereMobile
|
|
13
13
|
url: config.api_endpoint,
|
14
14
|
headers: {
|
15
15
|
'Accept' => 'application/json; charset=utf-8',
|
16
|
-
'User-Agent ' => config.user_agent,
|
17
|
-
'
|
18
|
-
'Authorization' => config.api_key
|
16
|
+
'User-Agent ' => config.user_agent || '',
|
17
|
+
'Authorization' => config.api_key || ''
|
19
18
|
}
|
20
19
|
}
|
21
20
|
|
22
21
|
Faraday::Connection.new(options) do |connection|
|
23
22
|
connection.request(:json)
|
24
|
-
connection.use :cookie_jar
|
23
|
+
connection.use :cookie_jar, jar: config.session
|
25
24
|
connection.use RevereMobile::Response::RaiseError
|
26
25
|
connection.adapter Faraday.default_adapter
|
27
26
|
end
|
@@ -3,7 +3,7 @@ require 'spec_helper'
|
|
3
3
|
describe "RevereMobile" do
|
4
4
|
it 'has a version number equal to 0.1.0' do
|
5
5
|
expect(RevereMobile::VERSION).to_not be nil
|
6
|
-
expect(RevereMobile::VERSION).to eq('0.1.
|
6
|
+
expect(RevereMobile::VERSION).to eq('0.1.1')
|
7
7
|
end
|
8
8
|
|
9
9
|
describe ".client" do
|
data/spec/spec_helper.rb
CHANGED
@@ -16,6 +16,10 @@ require 'faker'
|
|
16
16
|
require 'revere_mobile'
|
17
17
|
|
18
18
|
RSpec.configure do |config|
|
19
|
+
config.mock_with :rspec do |mocks|
|
20
|
+
mocks.verify_partial_doubles = true
|
21
|
+
end
|
22
|
+
|
19
23
|
config.color = true
|
20
24
|
config.expect_with :rspec do |expectations|
|
21
25
|
expectations.syntax = :expect
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revere_mobile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Samuel Robertson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -172,6 +172,26 @@ dependencies:
|
|
172
172
|
- - ">="
|
173
173
|
- !ruby/object:Gem::Version
|
174
174
|
version: 3.4.2
|
175
|
+
- !ruby/object:Gem::Dependency
|
176
|
+
name: awesome_print
|
177
|
+
requirement: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - "~>"
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '1.8'
|
182
|
+
- - ">="
|
183
|
+
- !ruby/object:Gem::Version
|
184
|
+
version: '1.8'
|
185
|
+
type: :development
|
186
|
+
prerelease: false
|
187
|
+
version_requirements: !ruby/object:Gem::Requirement
|
188
|
+
requirements:
|
189
|
+
- - "~>"
|
190
|
+
- !ruby/object:Gem::Version
|
191
|
+
version: '1.8'
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '1.8'
|
175
195
|
description: A wrapper for Revere Mobile API. Visit https://revolutionmessaging.com/revere/mobile/
|
176
196
|
for more information.
|
177
197
|
email:
|
@@ -233,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
233
253
|
version: '0'
|
234
254
|
requirements: []
|
235
255
|
rubyforge_project:
|
236
|
-
rubygems_version: 2.
|
256
|
+
rubygems_version: 2.4.8
|
237
257
|
signing_key:
|
238
258
|
specification_version: 4
|
239
259
|
summary: A wrapper for Revere Mobile API. Visit https://revolutionmessaging.com/revere/mobile/
|