flexirest 1.3.12 → 1.3.13

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: 6ccb5f8a0bd924da53a93a997101f645c495581b
4
- data.tar.gz: b5de1887d8f72fd6748e564a1dc35442f8a1469b
3
+ metadata.gz: bc2dd846c4d1cab6b3bc1fc2a1d162bfbb5419e9
4
+ data.tar.gz: fb4672356cf5e7fec571ebe73ff381d89a47f1ce
5
5
  SHA512:
6
- metadata.gz: 78a7b8f44082d9368f8826bdfcf5441b354c6bcaddbd7b71cdd2a96439e68aaa0d3eba53a6fc15c64d0d02c02929c8f33241b2b7521a9fd5089e552fa3f3e440
7
- data.tar.gz: bea87e9a033c49a21fac8a8b64aee4fc612a3b6aff5f8c94ab70aa2d2844fa4a9a1ce1b3655c69e151e4aeae2c504d4777b1cbbbad3c9ae9aafd092b3a8c6fa4
6
+ metadata.gz: 293a96596ed43f163a15614597913ddcf6682432176fd6d8fa32a31ca5db1adad77543e3384ab0f231ca97da7b62b5d392a03bca7b0d9f6073bc5863fc064919
7
+ data.tar.gz: a851723f3928d483b287b63744146aa28865a5148cbc74e0ad889d3bf4d1dec31f2bbe941b87bcc603c3dcdf7bdbfe5391e5aa4cf98bac16a2f1cd91b3f27197
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.3.13
4
+
5
+ Feature:
6
+
7
+ - The undocumented `plain: true` option to mapped methods was tested and documented.
8
+
3
9
  ## 1.3.12
4
10
 
5
11
  Bugfix:
data/README.md CHANGED
@@ -625,7 +625,7 @@ When url-encoding get parameters, Rudy adds brackets([]) by default to any param
625
625
  Person.all(param: [1, 2, 3])
626
626
  ```
627
627
 
628
- Ruby would encode the url as
628
+ Ruby would encode the url as
629
629
 
630
630
  ```
631
631
  ?param[]=1&param[]=2&param[]=3
@@ -688,6 +688,14 @@ Person._plain_request('http://api.example.com/v1/people', :post, {id:1234,name:"
688
688
 
689
689
  The parameters are the same as for `_request`, but it does no parsing on the response
690
690
 
691
+ You can also bypass the response parsing using a mapped method like this:
692
+
693
+ ```ruby
694
+ class Person < Flexirest::Base
695
+ get :all, "/v1/people", plain: true
696
+ end
697
+ ```
698
+
691
699
  ### Proxying APIs
692
700
 
693
701
  Sometimes you may be working with an old API that returns JSON in a less than ideal format or the URL or parameters required have changed. In this case you can define a descendent of `Flexirest::ProxyBase`, pass it to your model as the proxy and have it rework URLs/parameters on the way out and the response on the way back in (already converted to a Ruby hash/array). By default any non-proxied URLs are just passed through to the underlying connection layer. For example:
@@ -1,3 +1,3 @@
1
1
  module Flexirest
2
- VERSION = "1.3.12"
2
+ VERSION = "1.3.13"
3
3
  end
@@ -31,6 +31,7 @@ describe Flexirest::Request do
31
31
  put :headers_json, "/headers_json", request_body_type: :json
32
32
  get :find, "/:id"
33
33
  get :change, "/change"
34
+ get :plain, "/plain/:id", plain: true
34
35
  post :create, "/create"
35
36
  post :test_encoding, "/encoding", request_body_type: :json
36
37
  put :update, "/put/:id"
@@ -260,6 +261,12 @@ describe Flexirest::Request do
260
261
  expect(object.result).to eq(1234)
261
262
  end
262
263
 
264
+ it "should not parse JSON from a plain request" do
265
+ response_body = "This is another non-JSON string"
266
+ expect_any_instance_of(Flexirest::Connection).to receive(:get).with(any_args).and_return(::FaradayResponseMock.new(OpenStruct.new(status:200, response_headers:{}, body:response_body)))
267
+ expect(ExampleClient.plain(id:1234)).to eq(response_body)
268
+ end
269
+
263
270
  it "should return a lazy loader object if lazy loading is enabled" do
264
271
  object = LazyLoadedExampleClient.fake id:1234, debug:true
265
272
  expect(object).to be_an_instance_of(Flexirest::LazyLoader)
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.3.12
4
+ version: 1.3.13
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-04-28 00:00:00.000000000 Z
11
+ date: 2016-05-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler