action_kit_rest 0.3.7 → 0.3.8

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: 8edd438498d9c58a5a841f4a4c3e6cdf60332afb1596053321b8e95880657cea
4
- data.tar.gz: '048d66263cd0792e599aec8a79553bfe6068ab3c85bdfdee192258130792cb3a'
3
+ metadata.gz: 317f12658a694714e0daa94fce192f265b89f4e929e952e9a3ca2282564342a0
4
+ data.tar.gz: 3fa2bf0508101bb095b92fb48f24267f1ccfa2358194fc6c95463a8d8755293a
5
5
  SHA512:
6
- metadata.gz: 908a607ba995531f20b4815458b2a83eec71393abbd5a59979cf85e24c3d0736585f2fa0918c399e194abc96b2273058d707bf90ba79c8a4e870ac593cb128f4
7
- data.tar.gz: 1247bddf9d8d0ee0fa4a9ffbf6ea7b9cea15c34e8540838991ba17c238fef6a745b38502161251aa460853ad9482ea72166a8a4bdfa7a69ea1ef5812e424975e
6
+ metadata.gz: 8e305d2038f0d79db110442bda003084f4fc06d064d14a9c25353d072f4785228c8f88da18a6c51ce25db48cc3c1d130c6f354a457340fb5f2658f32c30043b5
7
+ data.tar.gz: bc614ab72455c91988e262086647207d4925d3e0139a74ec912f5279117e2d639e546a4e3b7f5e93bdba136280c96971f0971a9d8121d8db8a633f91c4872c10
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: action_kit_rest 0.3.7 ruby lib
5
+ # stub: action_kit_rest 0.3.8 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "action_kit_rest".freeze
9
- s.version = "0.3.7"
9
+ s.version = "0.3.8"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Nathan Woodhull".freeze, "Diego Marcet".freeze, "Jacinda Moore".freeze]
14
- s.date = "2018-12-04"
14
+ s.date = "2018-12-05"
15
15
  s.description = "Gem for interacting with the ActionKit API".freeze
16
16
  s.email = "systems@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -37,7 +37,9 @@ module ActionKitRest
37
37
  connection.stack do |builder|
38
38
  builder.use Faraday::Request::Multipart
39
39
  builder.use Faraday::Request::UrlEncoded
40
- builder.use Vertebrae::Request::BasicAuth, connection.configuration.authentication if connection.configuration.authenticated?
40
+ if connection.configuration.authenticated?
41
+ builder.use Faraday::Request::BasicAuthentication, connection.configuration.username, connection.configuration.password
42
+ end
41
43
 
42
44
  builder.use Faraday::Response::Logger if ENV['DEBUG']
43
45
 
@@ -2,7 +2,7 @@ module ActionKitRest
2
2
  module VERSION
3
3
  MAJOR = 0
4
4
  MINOR = 3
5
- PATCH = 7
5
+ PATCH = 8
6
6
  BUILD = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
@@ -1,9 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe ActionKitRest::User do
4
- before(:each) do
5
- @actionkit = ActionKitRest.new(host: 'test.com')
6
-
4
+ before :each do
7
5
  logger = double
8
6
  logger.stub(:debug).and_return(true)
9
7
 
@@ -11,45 +9,63 @@ describe ActionKitRest::User do
11
9
  Vertebrae::Base.stub(:logger).and_return(logger)
12
10
  end
13
11
 
12
+ subject { ActionKitRest.new(host: 'test.com') }
14
13
 
15
14
  describe "retrieval" do
16
15
  let(:request_path) { 'user/1/' }
17
16
 
18
- before(:each) do
19
- stub_get(request_path).to_return(:body => body, :status => status,
20
- :headers => {:content_type => "application/json; charset=utf-8"})
21
- end
17
+ context 'without basic auth' do
18
+ before(:each) do
19
+ stub_get(request_path).to_return(:body => body, :status => status,
20
+ :headers => {:content_type => "application/json; charset=utf-8"})
21
+ end
22
22
 
23
- describe ".get" do
24
- let(:status) { 200 }
23
+ describe ".get" do
24
+ let(:status) { 200 }
25
25
 
26
- context 'without phones' do
27
- let(:body) { fixture('user/object_without_phones.json') }
26
+ context 'without phones' do
27
+ let(:body) { fixture('user/object_without_phones.json') }
28
28
 
29
- it 'should return a user object' do
30
- expect(@actionkit.user.get(1).email).to eq 'walkers@wawd.com'
29
+ it 'should return a user object' do
30
+ expect(subject.user.get(1).email).to eq 'walkers@wawd.com'
31
+ end
32
+ end
33
+
34
+ context 'with phones' do
35
+ let(:body) { fixture('user/object_with_phones.json') }
36
+ let(:phone_body) { fixture('phone/object.json') }
37
+
38
+ it 'should include phones' do
39
+ stub_get('phone/?user=1').to_return(:body => phone_body, :status => 200)
40
+ expect(subject.user.get(1).phones.count).to eq 3
41
+ expect(subject.user.get(1).phones.map(&:phone)).to match_array(['7755555555', '7755555577', '310-310-3310'])
42
+ end
31
43
  end
32
44
  end
33
45
 
34
- context 'with phones' do
35
- let(:body) { fixture('user/object_with_phones.json') }
36
- let(:phone_body) { fixture('phone/object.json') }
46
+ describe 'user not found' do
47
+ let(:body) { '' }
48
+ let(:status) { 404 }
37
49
 
38
- it 'should include phones' do
39
- stub_get('phone/?user=1').to_return(:body => phone_body, :status => 200)
40
- expect(@actionkit.user.get(1).phones.count).to eq 3
41
- expect(@actionkit.user.get(1).phones.map(&:phone)).to match_array(['7755555555', '7755555577', '310-310-3310'])
50
+ it "should raise an exception" do
51
+ expect { subject.user.get(1) }.to raise_error(ActionKitRest::Response::NotFound)
42
52
  end
43
53
  end
44
54
  end
45
55
 
46
- describe 'user not found' do
47
- let(:body) { '' }
48
- let(:status) { 404 }
56
+ context 'with basic auth' do
57
+ let(:body) { fixture('user/object_without_phones.json') }
58
+
59
+ subject { ActionKitRest.new(host: 'test.com', username: 'alice', password: 'somesecret') }
60
+
61
+ before(:each) do
62
+ stub_get(request_path).with(basic_auth: ['alice', 'somesecret'])
63
+ .to_return(body: body, status: 200, headers: {content_type: "application/json; charset=utf-8"})
64
+ end
49
65
 
50
- it "should raise an exception" do
51
- expect { @actionkit.user.get(1) }.to raise_error(ActionKitRest::Response::NotFound)
66
+ it 'should return a user object' do
67
+ expect(subject.user.get(1).email).to eq 'walkers@wawd.com'
52
68
  end
53
69
  end
54
70
  end
55
- end
71
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: action_kit_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.7
4
+ version: 0.3.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2018-12-04 00:00:00.000000000 Z
13
+ date: 2018-12-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: vertebrae