abiquo-api 0.0.5 → 0.0.6
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 +4 -4
- data/lib/abiquo-api.rb +3 -1
- data/lib/abiquo-api/httpclient.rb +8 -5
- data/lib/abiquo-api/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96a3226fb37881a259d05429a2f9e45af89c614c
|
4
|
+
data.tar.gz: 692d1dd02caf070b11e79b916dac6186e442e5b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c9a61c26e512491b40a07f553856e1705bf678047ae2c2f6405ad4fdbd99225fcde3aa0b2a3235bcb6d5615c8053e59021f54a8de1dc922255a7ddad3bea9a5
|
7
|
+
data.tar.gz: a91b9bb302360c91ca442fc0ecf3eb99f930c630c144b8ec55b8baf048766d9a16508cc6d2f1bd46d63965b26aac26705951da1aeb10b2130113491d9767b116
|
data/lib/abiquo-api.rb
CHANGED
@@ -182,11 +182,13 @@ class AbiquoAPI
|
|
182
182
|
ctype = options[:content].nil? ? link.type : options.delete(:content)
|
183
183
|
accept = options[:accept].nil? ? link.type : options.delete(:accept)
|
184
184
|
|
185
|
+
data = data.to_json if data.respond_to?('to_json')
|
186
|
+
|
185
187
|
req_hash = {
|
186
188
|
:expects => [200, 201, 202, 204],
|
187
189
|
:method => 'POST',
|
188
190
|
:path => link.href,
|
189
|
-
:body => data
|
191
|
+
:body => data,
|
190
192
|
:query => options
|
191
193
|
}
|
192
194
|
|
@@ -65,15 +65,17 @@ module AbiquoAPIClient
|
|
65
65
|
params.reject!{|k,v| v.nil?}
|
66
66
|
|
67
67
|
# Setup Accept and Content-Type headers
|
68
|
-
headers={}
|
68
|
+
headers = {}
|
69
69
|
headers.merge!('Accept' => params.delete(:accept)) if params.has_key?(:accept)
|
70
70
|
headers.merge!('Content-Type' => params.delete(:content)) if params.has_key?(:content)
|
71
71
|
|
72
72
|
# Set Auth cookie and delete user and password if present
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
73
|
+
unless @cookies.nil?
|
74
|
+
@connection.data.delete(:user) unless @connection.data[:user].nil?
|
75
|
+
@connection.data.delete(:password) unless @connection.data[:password].nil?
|
76
|
+
headers.merge!(@cookies)
|
77
|
+
end
|
78
|
+
|
77
79
|
params[:headers] = headers
|
78
80
|
|
79
81
|
# Correct API path
|
@@ -100,6 +102,7 @@ module AbiquoAPIClient
|
|
100
102
|
#
|
101
103
|
def issue_request(options)
|
102
104
|
begin
|
105
|
+
options[:headers].merge!(@connection.headers)
|
103
106
|
resp = @connection.request(options)
|
104
107
|
|
105
108
|
# Save cookies
|
data/lib/abiquo-api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: abiquo-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marc Cirauqui
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: excon
|
@@ -107,9 +107,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
107
107
|
version: '0'
|
108
108
|
requirements: []
|
109
109
|
rubyforge_project:
|
110
|
-
rubygems_version: 2.
|
110
|
+
rubygems_version: 2.4.8
|
111
111
|
signing_key:
|
112
112
|
specification_version: 4
|
113
113
|
summary: Simple Abiquo API client
|
114
114
|
test_files: []
|
115
|
-
has_rdoc:
|