vertebrae 0.2.8 → 0.2.9

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: f861b36d6b690fa69885c6d4e990d8e27ad0d805
4
- data.tar.gz: f1ff08b103f8ed113ff33825fe7885347a7dba25
3
+ metadata.gz: b636dfc198fa18d2bbd56d43576c5c0d23856b2f
4
+ data.tar.gz: 5a96a3195d639196ee9d8ec35346ce2b3ff1f0c8
5
5
  SHA512:
6
- metadata.gz: b5fc580db4571f030a9ceb79da95adbee106da1c8e242190cf2f1ce7081e922798aecdd845ad5dde00d14852aa9271c90860bc721c075073384c670acd33eb54
7
- data.tar.gz: cb775c664198cd549567a0cd604a58f7f2654da32f90db4405470dfa16cbdc75b4e15f3b41542abb90d346135501adafb753b4fed3648c571a5ff7591e0ef699
6
+ metadata.gz: 12cc3175ee678bfef5a0d87b92a7b16dc6bcac15674cf346f626764c98bdfcff0615b88be476749907a093d7ef8e5de731be5b2d10e32ed7c1d9e3ca5f9f6da2
7
+ data.tar.gz: 5f97dfbab048ab323fa89f84789b24bf5a139f38d279a713911704289d707aca99f13873c3a4e4f88f232127822ca1458eed9223e942dff6838f53c7c06e8a09
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.9
data/lib/connection.rb CHANGED
@@ -23,10 +23,14 @@ module Vertebrae
23
23
  def initialize(options)
24
24
  @options = options
25
25
  @configuration = Vertebrae::Configuration.new(options)
26
- @connection = nil
27
26
  @stack = nil
28
27
  end
29
28
 
29
+ def options=(options)
30
+ @options = options
31
+ @configuration = Vertebrae::Configuration.new(options)
32
+ end
33
+
30
34
  # Default middleware stack that uses default adapter as specified at
31
35
  # configuration stage.
32
36
  #
@@ -59,14 +63,10 @@ module Vertebrae
59
63
  end
60
64
  end
61
65
 
62
- # Returns a Fraday::Connection object
66
+ # Returns a Faraday::Connection object
63
67
  #
64
68
  def connection
65
- if @connection
66
- @connection
67
- else
68
- @connection ||= Faraday.new(configuration.faraday_options.merge(:builder => stack))
69
- end
69
+ Faraday.new(configuration.faraday_options.merge(:builder => stack))
70
70
  end
71
71
  end
72
72
  end
data/lib/request.rb CHANGED
@@ -28,6 +28,7 @@ module Vertebrae
28
28
  if !::Vertebrae::Request::METHODS.include?(method)
29
29
  raise ArgumentError, "unknown http method: #{method}"
30
30
  end
31
+ connection.options = options
31
32
 
32
33
  path = connection.configuration.prefix + '/' + path
33
34
 
data/spec/api_spec.rb CHANGED
@@ -1,11 +1,26 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe Vertebrae::API do
4
-
5
4
  subject { described_class.new(options) }
6
5
 
7
6
  it { described_class.included_modules.should include Vertebrae::Request }
8
7
 
8
+ describe 'initialize' do
9
+ before(:each) do
10
+ Vertebrae::API.any_instance.stub(:default_options).and_return({content_type: 'foo'})
11
+ end
12
+
13
+ context 'with an empty hash' do
14
+ let(:options) { {} }
15
+ specify { expect(subject.connection.options).to eq({content_type: 'foo'}) }
16
+ end
17
+
18
+ context 'with a default content-type' do
19
+ let(:options) { {content_type: 'text/csv'} }
20
+ specify { expect(subject.connection.options).to eq({content_type: 'text/csv'}) }
21
+ end
22
+ end
23
+
9
24
  describe 'dummy' do
10
25
  describe 'should delegate to the client class' do
11
26
  specify{ Dummy.new.should respond_to(:api) }
data/vertebrae.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vertebrae 0.2.8 ruby lib
5
+ # stub: vertebrae 0.2.9 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vertebrae"
9
- s.version = "0.2.8"
9
+ s.version = "0.2.9"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Nathan Woodhull"]
14
- s.date = "2014-08-02"
14
+ s.date = "2014-08-04"
15
15
  s.description = "A set of low level infrastructure and reusable code for building API clients"
16
16
  s.email = "nathan@controlshiftlabs.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vertebrae
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.8
4
+ version: 0.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-02 00:00:00.000000000 Z
11
+ date: 2014-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport