api-client 2.7.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44c8775d6a585af08c1ac80b3263e77f4922983d
4
- data.tar.gz: 5be3312583e04df381e4a3c537515cf843b4a925
3
+ metadata.gz: 748d015f42e4dbf265255c6d94dd5b930a292be8
4
+ data.tar.gz: f3ed098def84e5ee960bd9a4b2868fc882274d24
5
5
  SHA512:
6
- metadata.gz: 14583a5cabbfe1fa3a2eb56c9bb96c39343e19fcecaf224a15dac5f3babbfa7a584c57899db1f2b9e8241a6970a2e3adfb368a3919c11f1fa3e2d29066185904
7
- data.tar.gz: 7f42c5147782929e1c0b4972b421fb12cbc599f0044cd2a943ca165bbb9953ecd4c816ba6bf972a9d32028d40cb860c72b63954319822ff1719bd69a94334ea2
6
+ metadata.gz: a10e8dba5c3d37e29829f651f5cc78dcc27e416501ca64a7d70f4d9220b64d28bb019f09afe3d93a8ba4ef21d55f1860616ba9548560153409e038242d0c8037
7
+ data.tar.gz: c7a04bcd27fbc508bfa567437bd63109c741d7a1e43e9c9aa3d610cee2313bc9beb33ba77c6d9dcbccc7fb6b62b5659bf1206edd6e6369bb3cf720623cd31050
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.0.0
1
+ 2.0.0
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## v3.0.0
4
+
5
+ * Automatically sending attributes with root_node when calling methods on class.
6
+
3
7
  ## v2.7.0
4
8
 
5
9
  * Fixed update routes to add resource id.
data/README.md CHANGED
@@ -190,6 +190,22 @@ ApiClient.parallel do
190
190
  end
191
191
  ```
192
192
 
193
+ ## Migrating from 2.*.* to 3.0.0
194
+
195
+ Since version 3.0.0 is not necessarily set the root_node on the attributes when calling methods on the class.
196
+
197
+ Before:
198
+
199
+ ```ruby
200
+ @user = User.create({ :user => attributes })
201
+ ```
202
+
203
+ After:
204
+
205
+ ```ruby
206
+ @user = User.create(attributes )
207
+ ```
208
+
193
209
  ## More Examples
194
210
  [Project](https://github.com/zertico/api-client/tree/master/examples)
195
211
 
@@ -15,7 +15,7 @@ class BookController < ApplicationController
15
15
 
16
16
  # It will hit http://api.example.com/books with a post request
17
17
  def create
18
- @book = Book.create(:book => params[:book])
18
+ @book = Book.create(params[:book])
19
19
  respond_with(@user)
20
20
  end
21
21
 
@@ -27,7 +27,7 @@ class BookController < ApplicationController
27
27
 
28
28
  # It will hit http://api.example.com/books with a put request
29
29
  def update
30
- @book = Book.update_attributes(params[:id], { :book => params[:book] })
30
+ @book = Book.update_attributes(params[:id], params[:book])
31
31
  respond_with(@book)
32
32
  end
33
33
 
@@ -15,7 +15,7 @@ class UserController < ApplicationController
15
15
 
16
16
  # It will hit http://api.example.com/users with a post request
17
17
  def create
18
- @user = User.post({ :user => params[:user] })
18
+ @user = User.post(params[:user])
19
19
  respond_with(@user)
20
20
  end
21
21
 
@@ -27,7 +27,7 @@ class UserController < ApplicationController
27
27
 
28
28
  # It will hit http://api.example.com/users with a patch request
29
29
  def update
30
- @user = User.patch(params[:id], { :user => params[:user] })
30
+ @user = User.patch(params[:id], params[:user])
31
31
  respond_with(@user)
32
32
  end
33
33
 
@@ -23,7 +23,7 @@ module ApiClient
23
23
  def post(attributes, header = {})
24
24
  return new(attributes) if ApiClient.config.mock
25
25
  url = "#{ApiClient.config.path[path]}#{self.resource_path}"
26
- response = ApiClient::Dispatcher.post(url, attributes, header)
26
+ response = ApiClient::Dispatcher.post(url, { self.root_node.to_sym => attributes }, header)
27
27
  build(response, url)
28
28
  end
29
29
 
@@ -37,7 +37,7 @@ module ApiClient
37
37
  def put(id, attributes, header = {})
38
38
  return new(attributes) if ApiClient.config.mock
39
39
  url = "#{ApiClient.config.path[path]}#{self.resource_path}/#{id}"
40
- response = ApiClient::Dispatcher.put(url, attributes, header)
40
+ response = ApiClient::Dispatcher.put(url, { self.root_node.to_sym => attributes }, header)
41
41
  build(response, url)
42
42
  end
43
43
 
@@ -51,7 +51,7 @@ module ApiClient
51
51
  def patch(id, attributes, header = {})
52
52
  return new(attributes) if ApiClient.config.mock
53
53
  url = "#{ApiClient.config.path[path]}#{self.resource_path}/#{id}"
54
- response = ApiClient::Dispatcher.patch(url, attributes, header)
54
+ response = ApiClient::Dispatcher.patch(url, { self.root_node.to_sym => attributes }, header)
55
55
  build(response, url)
56
56
  end
57
57
 
@@ -1,5 +1,5 @@
1
1
  # High Level Namespace of the library ApiClient.
2
2
  module ApiClient
3
3
  # Version of the library.
4
- VERSION = '2.7.0'
4
+ VERSION = '3.0.0'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: api-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Henrique Lopes Ribeiro