revere_mobile 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 83455b42722c1f3d5a04a9a735942bf4e1cb055d
4
- data.tar.gz: c0e462db54408ac3c37a0eae6f5a55b92f1fec9c
3
+ metadata.gz: da977da2155a9df2f3118822e2aa328a0e9c6f3f
4
+ data.tar.gz: b144d93bd0509c5ec0b6771d690199b5cfbcf8d9
5
5
  SHA512:
6
- metadata.gz: 278df3e7393a4a2a597e236b9a8ceeb857de7964e1f5c06e6705cdbdd4be2d81b6c2a1092f402515af69d509dba1fc0e3a7d709e8b87da5116d4af36851b4d4c
7
- data.tar.gz: ef0be38bccefcd987c5364bab81500c9f1244a6e049d7597552ad22af4b88f3abc5d4224dd798e550c98d63213156571f8f2cc66f9afb9ef0ba67cbfe1b39947
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
- - TODO: Put some build status things here
3
+ [![Build
4
+ Status](https://travis-ci.org/revolution-messaging/revere_mobile_ruby_client.svg?branch=master)](https://travis-ci.org/revolution-messaging/revere_mobile_ruby_client)
5
+ [![Gem Version](https://badge.fury.io/rb/revere_mobile.svg)](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
- conn = Faraday.new(url: config.api_endpoint) { |f| f.use :cookie_jar; f.adapter Faraday.default_adapter; }
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 '/api/v1/authenticate'
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
- config.session = response.headers['set-cookie']
23
+
24
+
25
+ config.session = temp_cookie_jar
16
26
  response
17
27
  end
18
28
 
@@ -76,7 +76,7 @@ module RevereMobile
76
76
  @api_key = RevereMobile::Default.api_key
77
77
  @user_agent = RevereMobile::Default.user_agent
78
78
  @query_size = RevereMobile::Default.query_size
79
- @session = nil
79
+ @session = HTTP::CookieJar.new
80
80
  self
81
81
  end
82
82
 
@@ -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
- 'Cookie' => config.session,
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RevereMobile
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  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.0')
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.0
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-08 00:00:00.000000000 Z
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.6.14
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/