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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ac0a5ff9c10d0b39f113f768cb9d93c68bd271b3
4
- data.tar.gz: f69f314150ee749e51083511e005cc75b089cb1a
3
+ metadata.gz: 96a3226fb37881a259d05429a2f9e45af89c614c
4
+ data.tar.gz: 692d1dd02caf070b11e79b916dac6186e442e5b4
5
5
  SHA512:
6
- metadata.gz: eb7a621e40a32e64d54f5b56e844e2023e058c20ea9b17ffb7744824756d8effa99bc67ff1385637796b1987b99558b67ac8e0fc7539fcb3442c265f668b29da
7
- data.tar.gz: d9b10fc59d6f339d1bf63a8969e88d105c6a013e43bbac0ba717fcd69ffd63ef57fb61714b4f0d1d2f86cbb0582fb35de14c7928668cd9d363e7c69b2105fc49
6
+ metadata.gz: 0c9a61c26e512491b40a07f553856e1705bf678047ae2c2f6405ad4fdbd99225fcde3aa0b2a3235bcb6d5615c8053e59021f54a8de1dc922255a7ddad3bea9a5
7
+ data.tar.gz: a91b9bb302360c91ca442fc0ecf3eb99f930c630c144b8ec55b8baf048766d9a16508cc6d2f1bd46d63965b26aac26705951da1aeb10b2130113491d9767b116
@@ -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.to_json,
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
- @connection.data.delete(:user) unless @connection.data[:user].nil?
74
- @connection.data.delete(:password) unless @connection.data[:password].nil?
75
- headers.merge!(@cookies) unless @cookies.nil?
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
@@ -1,3 +1,3 @@
1
1
  module AbiquoAPIClient
2
- VERSION = '0.0.5'
2
+ VERSION = '0.0.6'
3
3
  end
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.5
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: 2015-02-23 00:00:00.000000000 Z
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.2.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: