flexirest 1.2.15 → 1.2.16

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: f564de9b39812ec29fb0d9076fc88df9d8fc795b
4
- data.tar.gz: d9d798138713953c4e3ad3ac10362e032042a860
3
+ metadata.gz: 67924c36e94f6b5a9ad4cbdf09d7762c20b88ecd
4
+ data.tar.gz: 2ac29ea6fef0704c66d7af8105d7009bdeb0141b
5
5
  SHA512:
6
- metadata.gz: 6cd7ff1ddef1a9ded44a59d354de2c4791087b35f272f38174ff8c680d2b398643c064c01fc248b1626be1b52386dba5a7f576bc9d045e5126d8353e39481531
7
- data.tar.gz: fa438316661d96aff7e2e57f502f6c38f1695e38fc8ddfe1e035d739a61c8ffe70efc0f9285f71e49d19c3b3029133a12532931cf6b69f6005e1313778d30e62
6
+ metadata.gz: 682f4f180a66df72de50b82cd3263b5c3e9f6d2fc70c23b3ed49a5cf7e3242d8bf0526f0e4d2834e37f80f48915fe09d9907cf286ca60f7584703703d355d0b2
7
+ data.tar.gz: cb065db508aaf6ce615d42e353436b8da4b4c5cb17fd9d3f7b07f6dcb5cc7ee5d8e2da9d30efc9dc9ea6fc316c1179c32783160dddbefca589a2ecf129269c80
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.2.16
4
+
5
+ Feature:
6
+
7
+ - Replaces URL :keyed parameters for direct requests.
8
+
9
+ ## 1.2.15
10
+
11
+ Feature:
12
+
13
+ - Fixing issue when moving from ActiveRestClient to Flexirest - cached responses have the old class in them, so come through as a String
14
+
3
15
  ## 1.2.14
4
16
 
5
17
  Bugfixes:
@@ -68,12 +68,10 @@ module Flexirest
68
68
  Flexirest::LazyLoader.new(prepare_direct_request(request, method), params)
69
69
  end
70
70
 
71
- def self.prepare_direct_request(request, method, options={})
71
+ def self.prepare_direct_request(request, method = :get, options={})
72
72
  unless request.is_a? Flexirest::Request
73
73
  options[:plain] ||= false
74
- mapped = {url:"DIRECT-CALLED-#{request}", method:method, options:{url:request, plain:options[:plain]}}
75
-
76
- request = Request.new(mapped, self)
74
+ request = Flexirest::Request.new({ url: request, method: method, options: options }, self)
77
75
  end
78
76
  request
79
77
  end
@@ -305,6 +305,8 @@ module Flexirest
305
305
  @base_url = "#{uri.scheme}://#{uri.host}#{":#{uri.port}" if uri.port != 80 && uri.port != 443}"
306
306
  @url = "#{base_url}#{@url}".gsub(@base_url, "")
307
307
  base_url = @base_url
308
+ else
309
+ base_url = parts[0]
308
310
  end
309
311
  base_url.gsub!(%r{//(.)}, "//#{username}:#{password}@\\1") if username && !base_url[%r{//[^/]*:[^/]*@}]
310
312
  connection = Flexirest::ConnectionManager.get_connection(base_url)
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.2.15"
2
+ VERSION = "1.2.16"
3
3
  end
@@ -323,7 +323,7 @@ describe Flexirest::Base do
323
323
  response = "This is a non-JSON string"
324
324
  other_response = "This is another non-JSON string"
325
325
  allow_any_instance_of(Flexirest::Connection).to receive(:get) do |instance, url, others|
326
- if url == "/?test=1"
326
+ if url["/?test=1"]
327
327
  ::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:response))
328
328
  else
329
329
  ::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:other_response))
@@ -351,6 +351,11 @@ describe Flexirest::Base do
351
351
  EmptyExample._request("http://api.example.com/", :post, {id:1234})
352
352
  end
353
353
 
354
+ it "should be able to replace parameters in the URL for the call" do
355
+ expect_any_instance_of(Flexirest::Connection).to receive(:post).with("http://api.example.com/1234", "", any_args).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:"{\"first_name\":\"Billy\"}")))
356
+ EmptyExample._request("http://api.example.com/:id", :post, {id:1234})
357
+ end
358
+
354
359
  it "should be able to use mapped methods to create a request to pass in to _lazy_request" do
355
360
  expect_any_instance_of(Flexirest::Connection).to receive(:get).with('/find/1', anything).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:"{\"first_name\":\"Billy\"}")))
356
361
  request = AlteringClientExample._request_for(:find, :id => 1)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flexirest
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.15
4
+ version: 1.2.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Jeffries
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-27 00:00:00.000000000 Z
11
+ date: 2016-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler