ruby_vcloud_sdk 0.7.3 → 0.7.4

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: fcc4f8c4054702308f57599fea2ceb4925b9a11b
4
- data.tar.gz: ddb9c58cbb511ae531471d308587395dd139d940
3
+ metadata.gz: b9a012eae399e7abe8812f84b55f391b33cca973
4
+ data.tar.gz: d4446f95752c3a8774387ab9d3683a754f33a3ff
5
5
  SHA512:
6
- metadata.gz: fcbd5a26015f03ec2ddfa3e48bd95174e90cb8fbf65000ec5f9b87bfb4996e227d24ba0841ab067405c573c1641239b91105af37d4d6f4d009d0567a7c5761c0
7
- data.tar.gz: b7d229f94d155499287221372245a7b483289885ba80e91fba9b8820f8187a965a0858f8368963df05eaef21da2ca6628cbf653e33e0477d921c12c712d91f66
6
+ metadata.gz: c6595515e0cac1c255ed5ae9b7a57f415f5a1169105039e28bd3d64451ac578e8278817847c60ea397b97df68454c53ada594e0e1b9ac7adfbdda9f70b06ca0f
7
+ data.tar.gz: 6ae850f08762b65eb2dfc56d09d99c0e5c93879492052e1fb767c154584ed384bd472bea1fd9b6f3a7afc198c70e463c6ab68bc9f4bee9777a67f13588fd82f7
@@ -31,14 +31,11 @@ module VCloudSdk
31
31
 
32
32
  def connect(username, password)
33
33
  login_password = "#{username}:#{password}"
34
- auth_header_value = "Basic #{Base64.encode64(login_password)}"
34
+ auth_header_value = "Basic #{Base64.strict_encode64(login_password)}"
35
35
  response = @site[login_url].post("",
36
36
  Authorization: auth_header_value, Accept: ACCEPT)
37
37
  Config.logger.debug(response)
38
- @cookies = response.cookies
39
- unless @cookies["vcloud-token"].gsub!("+", "%2B").nil?
40
- Config.logger.debug("@cookies: #{@cookies.inspect}.")
41
- end
38
+ @vcloud_auth_header = response.headers[:x_vcloud_authorization]
42
39
  wrap_response(response)
43
40
  end
44
41
 
@@ -49,7 +46,7 @@ module VCloudSdk
49
46
  sleep(delay)
50
47
  response = @site[get_nested_resource(destination)].get(
51
48
  Accept: ACCEPT,
52
- cookies: @cookies)
49
+ x_vcloud_authorization: @vcloud_auth_header)
53
50
  @rest_logger.debug(response)
54
51
  wrap_response(response)
55
52
  end
@@ -65,7 +62,7 @@ module VCloudSdk
65
62
  @rest_logger.info("#{__method__.to_s.upcase} data:#{data.to_s}")
66
63
  response = @site[get_nested_resource(destination)].post(data.to_s, {
67
64
  Accept: ACCEPT,
68
- cookies: @cookies,
65
+ x_vcloud_authorization: @vcloud_auth_header,
69
66
  content_type: content_type
70
67
  })
71
68
  fail ApiRequestError if http_error?(response)
@@ -84,7 +81,7 @@ module VCloudSdk
84
81
  @rest_logger.info("#{__method__.to_s.upcase} data:#{data.to_s}")
85
82
  response = @site[get_nested_resource(destination)].put(data.to_s,
86
83
  Accept: ACCEPT,
87
- cookies: @cookies,
84
+ x_vcloud_authorization: @vcloud_auth_header,
88
85
  content_type: content_type
89
86
  )
90
87
  fail ApiRequestError if http_error?(response)
@@ -103,7 +100,7 @@ module VCloudSdk
103
100
  sleep(delay)
104
101
  response = @site[get_nested_resource(destination)].delete(
105
102
  Accept: ACCEPT,
106
- cookies: @cookies
103
+ x_vcloud_authorization: @vcloud_auth_header,
107
104
  )
108
105
  @rest_logger.debug(response)
109
106
  if response && !response.strip.empty?
@@ -120,7 +117,7 @@ module VCloudSdk
120
117
  def put_file(destination, file)
121
118
  href = self.class.get_href(destination)
122
119
  @rest_logger.info "#{__method__.to_s.upcase}\t#{href}"
123
- response = @file_uploader.upload(href, file, @cookies)
120
+ response = @file_uploader.upload(href, file, @vcloud_auth_header)
124
121
  response
125
122
  end
126
123
 
@@ -3,8 +3,8 @@ module VCloudSdk
3
3
 
4
4
  class FileUploader
5
5
  class << self
6
- def upload(href, file, cookies = nil, http_method = :Put)
7
- request = create_request(href, file, cookies, http_method)
6
+ def upload(href, file, vcloud_auth_header, http_method = :Put)
7
+ request = create_request(href, file, vcloud_auth_header, http_method)
8
8
  net = create_connection(href)
9
9
  net.start do |http|
10
10
  response = http.request(request) {
@@ -17,9 +17,9 @@ module VCloudSdk
17
17
 
18
18
  private
19
19
 
20
- def create_request(href, file, cookies = nil, http_method = :Put)
21
- headers = cookies ? {"Cookie" => cookies.map { |(key, val)|
22
- "#{key.to_s}=#{CGI::unescape(val)}" }.sort.join(";")} : {}
20
+ def create_request(href, file, vcloud_auth_header, http_method = :Put)
21
+ headers = {}
22
+ headers["x-vcloud-authorization"] = vcloud_auth_header
23
23
  # Ruby 1.8 does not have size on the file object
24
24
  headers["Content-Length"] = File.size(file.path).to_s
25
25
  headers["Transfer-Encoding"] = "chunked"
@@ -1,3 +1,3 @@
1
1
  module VCloudSdk
2
- VERSION = '0.7.3'
2
+ VERSION = '0.7.4'
3
3
  end
metadata CHANGED
@@ -1,88 +1,88 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_vcloud_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.3
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - VMware
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-06-08 00:00:00.000000000 Z
11
+ date: 2015-07-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: httpclient
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.4.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.4.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rest-client
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 1.6.7
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.6.7
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: nokogiri
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.5.6
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.5.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: netaddr
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  description: |-
84
84
  BOSH vCloud API client
85
- 0efc6d
85
+ 92d56d
86
86
  email: support@cloudfoundry.com
87
87
  executables: []
88
88
  extensions: []
@@ -369,17 +369,17 @@ require_paths:
369
369
  - lib
370
370
  required_ruby_version: !ruby/object:Gem::Requirement
371
371
  requirements:
372
- - - '>='
372
+ - - ">="
373
373
  - !ruby/object:Gem::Version
374
374
  version: 1.9.3
375
375
  required_rubygems_version: !ruby/object:Gem::Requirement
376
376
  requirements:
377
- - - '>='
377
+ - - ">="
378
378
  - !ruby/object:Gem::Version
379
379
  version: '0'
380
380
  requirements: []
381
381
  rubyforge_project:
382
- rubygems_version: 2.2.0
382
+ rubygems_version: 2.4.4
383
383
  signing_key:
384
384
  specification_version: 4
385
385
  summary: BOSH vCloud API client