json_api_toolbox 0.16.0 → 0.16.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: 2d33816c28038995cf4e2224903f03411e9549a1
4
- data.tar.gz: 91203e54fa5e9d19e60b9873a4db25b0725840e7
3
+ metadata.gz: 84d7e3e998fe1b7dd81c3c14ecca011b1865402b
4
+ data.tar.gz: afd1306f2819f14a7cdbd3a7efd0c5ad36ff562f
5
5
  SHA512:
6
- metadata.gz: e08c1c7e13b148b2c9eb0176ed0e41e8f25e3ace7551b50df6fca3c3f4ad73413cf678839e38c3fc7b95c6716d23b541ae9b320fab509c37299dd72c97c3c7d3
7
- data.tar.gz: d59ead9e3b2de9cc8cd087344fccdf8fa4f797747e584d03c2d759e5e8c92ad782656b2a1c4ffacfd888056f0ba2ed250ed7b46530f8f435b7e061df84ba7ebe
6
+ metadata.gz: 76b1f72a931e1544401e9e8e70457ea0a4ad30850d9a1d321de7f225b80d859ee9d2ddc6d41e3e86c3f6f53810d8ba2ba7282be5c1abc9aae8f117c433395fb9
7
+ data.tar.gz: 1200fe389638afd9d8e829c7cf1bf4be284238bbb413d299238bde81ee1cb5d48ec0c3218cba96f28e1528dc9f43671aa31bb88b32b6ec7625d4d958e369464e
data/CHANGELOG.md CHANGED
@@ -5,9 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
5
5
  and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
6
6
 
7
7
  ## [Unreleased]
8
+ ## [0.16.1] - 2018-08-14
9
+ ### Fixed
10
+ - Fixed warning when payload body is a hash at JsonApiToolbox::Service
8
11
 
9
12
  ## [0.16.0] - 2018-08-14
10
- ### Fixed
13
+ ### Added
11
14
  - Added method `.put` to JsonApiToolbox::Service
12
15
 
13
16
  ## [0.15.1] - 2018-07-02
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsonApiToolbox
4
- VERSION = '0.16.0'
4
+ VERSION = '0.16.1'
5
5
  end
data/lib/service.rb CHANGED
@@ -6,10 +6,10 @@ require 'json-api-vanilla'
6
6
 
7
7
  module JsonApiToolbox
8
8
  class Service
9
- attr_reader :method, :url, :body
9
+ attr_reader :http_method, :url, :body
10
10
 
11
- def initialize(method, url, body)
12
- @method = method
11
+ def initialize(http_method, url, body)
12
+ @http_method = http_method
13
13
  @url = url
14
14
  @body = body
15
15
  end
@@ -22,7 +22,7 @@ module JsonApiToolbox
22
22
 
23
23
  def request
24
24
  RestClient::Request.execute(
25
- method: method,
25
+ http_method: http_method,
26
26
  url: url,
27
27
  payload: build_body,
28
28
  headers: build_header
@@ -36,12 +36,14 @@ module JsonApiToolbox
36
36
  'Authorization' => RequestStore.store[:token],
37
37
  'Content-Type' => 'application/json'
38
38
  }
39
- headers[:params] = body if method == :get
39
+ headers[:params] = body if http_method == :get
40
40
  headers
41
41
  end
42
42
 
43
43
  def build_body
44
- return body if method != :get
44
+ return if http_method == :get
45
+
46
+ body.is_a?(Hash) ? body.to_json : body
45
47
  end
46
48
 
47
49
  class << self
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_api_toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0
4
+ version: 0.16.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adriano Bacha
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-14 00:00:00.000000000 Z
11
+ date: 2018-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionpack