apicasso_brush 0.1.1 → 0.1.2

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
  SHA256:
3
- metadata.gz: 8b19e94043a6ffdbb970fdcb3d2d7a278e11100a08c430265706df50346b352c
4
- data.tar.gz: 8c09dc87c6fbe6385282b872ff68526019c5aedad7a47ff118becbdfb175cb09
3
+ metadata.gz: 8a738a104da128abfd332a26badbf2778fb687bbcfbd2e08418bb21757de14cb
4
+ data.tar.gz: 3a6a86da89689ab48a1cec3630c8740a7e4db7682617aed4cf78fa6c997fa9e0
5
5
  SHA512:
6
- metadata.gz: d2b972d420190fc42d1a07a026473467617726ceb3f7d3b0daf958b31ca1a06f06956a40316221d52a8a641608c08d289c26b3f88ae61d8f066e2e2fead1d72f
7
- data.tar.gz: 02b45578d4324c291827f1523e21e479ace990383d9b3a506566d5fd2be6db0e4986b22bad61acb8c21b897d5adafecfdb71beca6ede21a7306ff32f14a2591b
6
+ metadata.gz: 37d1ab34aaaedf081875b8187dedd974abae46079721a00b6293e1b7da715da806452ca184eebf326e8c92a094987b6af1b57e4bbca78172b4320cd054424c12
7
+ data.tar.gz: 2f1cb984a94b7fdaadfd779b06ee2eb29e931260fd5e9a4f1a843208e4a7efd1fae223f720b3008d3407481a9a85286a332258d287af51c2e81cd9067f9d4772
@@ -113,8 +113,8 @@ module Apicasso
113
113
 
114
114
  brush_collection(JSON.parse(retrieve(http, post_request(url, opts)).read_body))
115
115
  else
116
- http = Net::HTTP.new(url.host, url.port)
117
116
  url = URI.parse(resource_url.to_s)
117
+ http = Net::HTTP.new(url.host, url.port)
118
118
 
119
119
  new(nil, JSON.parse(retrieve(http, post_request(url, opts)).read_body))
120
120
  end
@@ -134,7 +134,7 @@ module Apicasso
134
134
 
135
135
  # Finds a object based on attributes conditions
136
136
  def self.find_by(opts = {})
137
- where(opts)[:entries][0]
137
+ where(opts).to_h[:entries].try(:[], 0)
138
138
  end
139
139
 
140
140
  # Finds a object based on attributes conditions,
@@ -240,7 +240,7 @@ module Apicasso
240
240
  request = Net::HTTP::Patch.new(url)
241
241
  request['Authorization'] = "Token token=#{apicasso_token}"
242
242
  request['Content-Type'] = 'application/json'
243
- request.body = { name.underscore => body }.to_json
243
+ request.body = { resource_url.split('/').last.singularize => body }.to_json
244
244
  request
245
245
  end
246
246
 
@@ -248,7 +248,7 @@ module Apicasso
248
248
  request = Net::HTTP::Post.new(url)
249
249
  request['Authorization'] = "Token token=#{apicasso_token}"
250
250
  request['Content-Type'] = 'application/json'
251
- request.body = { name.underscore => body }.to_json
251
+ request.body = { resource_url.split('/').last.singularize => body }.to_json
252
252
  request
253
253
  end
254
254
 
@@ -1,3 +1,3 @@
1
1
  module ApicassoBrush
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apicasso_brush
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fernando Bellincanta
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-15 00:00:00.000000000 Z
11
+ date: 2019-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails