bits_service_client 0.3.2 → 2.0.0.pre.1

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: 070b68ab65a8f241bc20dea88acccdeed3606fde
4
- data.tar.gz: 7622faacb43ca9c44d96b7a3ef6b7d8c24c4ea60
3
+ metadata.gz: fdfa2fa5067f15c29f8b4c76ab9acf3c483615bb
4
+ data.tar.gz: bc04fd40537a4e4fb93d46aa9ceab36c98b3aee2
5
5
  SHA512:
6
- metadata.gz: 3a842ec2c61158a8a514d05838346d6206bbed3752bdf03fcdf14994937f0d0c05a68b66e7ecd7098c7bbaee71b6c728b0e156dcee89030af8f47dc20698a3b8
7
- data.tar.gz: 6ce2b9d646ddd8fcbb2b4d577fe0f20920449dbc0f2828c075c0362834e9f6a50ce2859f6ee420d55dd01365205ec266b4ab210c7be927fb2e35e3b8c0e0ff5b
6
+ metadata.gz: a74e284649cddb7723e944d7bf5912818b72db734f724b5b95b0885a49b137b1e20df7f4893a220c4b5a6e6a4eb78c509869a675b66210f5f8cf0dea406eca76
7
+ data.tar.gz: 5e4bdf88df7c5e649fbfbeda92e1e17f3f09c8125af04df96cdce4f5e7d21d3389a86461932d8f75c86bcf15982e7a90e2cff629fd4e3ddc03fb674b1be3b01f
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.2
@@ -165,7 +165,7 @@ module BitsService
165
165
  response: response
166
166
  }.to_json
167
167
 
168
- logger.error("UnexpectedResponseCode: expected '#{expected_codes}' got #{error}")
168
+ logger.error("UnexpectedResponseCode: expected '#{expected_codes}' got #{response.code}")
169
169
 
170
170
  fail BlobstoreError.new(error)
171
171
  end
@@ -15,15 +15,13 @@ module BitsService
15
15
  end
16
16
  end
17
17
 
18
- def upload_entries(entries_path)
19
- with_file_attachment!(entries_path, 'entries.zip') do |file_attachment|
20
- body = { application: file_attachment }
21
- multipart_post('/app_stash/entries', body, @vcap_request_id)
22
- end
23
- end
24
-
25
- def bundles(resources_json)
26
- post('/app_stash/bundles', resources_json, @vcap_request_id).tap do |response|
18
+ def bundles(resources_json, entries_path)
19
+ validate_file! entries_path
20
+ body = {
21
+ resources: UploadIO.new(StringIO.new(resources_json),'application/json', 'resources.json'),
22
+ application: UploadIO.new(entries_path, 'application/octet-stream', 'entries.zip')
23
+ }
24
+ multipart_post('/app_stash/bundles', body, @vcap_request_id).tap do |response|
27
25
  validate_response_code!(200, response)
28
26
  end
29
27
  end
@@ -41,20 +39,11 @@ module BitsService
41
39
  response: response
42
40
  }.to_json
43
41
 
44
- @logger.error("UnexpectedResponseCode: expected #{expected} got #{error}")
42
+ @logger.error("UnexpectedResponseCode: expected #{expected} got #{response.code}")
45
43
 
46
44
  fail Errors::UnexpectedResponseCode.new(error)
47
45
  end
48
46
 
49
- def with_file_attachment!(file_path, filename, &block)
50
- validate_file! file_path
51
-
52
- File.open(file_path) do |file|
53
- attached_file = UploadIO.new(file, 'application/octet-stream', filename)
54
- yield attached_file
55
- end
56
- end
57
-
58
47
  def validate_file!(file_path)
59
48
  return if File.exist?(file_path)
60
49
 
@@ -69,10 +58,7 @@ module BitsService
69
58
  end
70
59
 
71
60
  def multipart_post(path, body, vcap_request_id)
72
- request = Net::HTTP::Post::Multipart.new(path, body)
73
- do_request(http_client, request, vcap_request_id).tap do |response|
74
- validate_response_code!(201, response)
75
- end
61
+ do_request(http_client, Net::HTTP::Post::Multipart.new(path, body), vcap_request_id)
76
62
  end
77
63
 
78
64
  def do_request(http_client, request, vcap_request_id)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module BitsServiceClient
3
- VERSION = '0.3.2'
3
+ VERSION = '2.0.0.pre.1'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bits_service_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 2.0.0.pre.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rizwan Reza
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2018-05-14 00:00:00.000000000 Z
14
+ date: 2018-05-22 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activesupport
@@ -166,6 +166,7 @@ files:
166
166
  - ".gitignore"
167
167
  - ".rspec"
168
168
  - ".rubocop.yml"
169
+ - ".ruby-version"
169
170
  - Gemfile
170
171
  - Guardfile
171
172
  - LICENSE
@@ -194,9 +195,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
194
195
  version: '0'
195
196
  required_rubygems_version: !ruby/object:Gem::Requirement
196
197
  requirements:
197
- - - ">="
198
+ - - ">"
198
199
  - !ruby/object:Gem::Version
199
- version: '0'
200
+ version: 1.3.1
200
201
  requirements: []
201
202
  rubyforge_project:
202
203
  rubygems_version: 2.6.14.1