Class: BitsService::ResourcePool
- Inherits:
-
Object
- Object
- BitsService::ResourcePool
- Includes:
- SignatureUtil
- Defined in:
- lib/bits_service_client/resource_pool.rb
Instance Method Summary collapse
- #bundles(resources_json, entries_path) ⇒ Object
-
#initialize(bits_service_options:, request_timeout_in_seconds:, vcap_request_id: '') ⇒ ResourcePool
constructor
A new instance of ResourcePool.
- #matches(resources_json) ⇒ Object
- #signed_matches_url ⇒ Object
Methods included from SignatureUtil
#seconds_since_the_unix_epoch_with_offset, #sign_signature
Constructor Details
#initialize(bits_service_options:, request_timeout_in_seconds:, vcap_request_id: '') ⇒ ResourcePool
Returns a new instance of ResourcePool.
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/bits_service_client/resource_pool.rb', line 9 def initialize(bits_service_options:, request_timeout_in_seconds:, vcap_request_id: '') @private_endpoint = URI.parse([:private_endpoint]) @public_endpoint = URI.parse([:public_endpoint]) @request_timeout_in_seconds = request_timeout_in_seconds @signed_key_secret = validated(, :signing_key_secret) @signed_key_id = validated(, :signing_key_id) @vcap_request_id = vcap_request_id @logger = Steno.logger('cc.bits_service_client') @ca_cert_path = [:ca_cert_path] end |
Instance Method Details
#bundles(resources_json, entries_path) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/bits_service_client/resource_pool.rb', line 30 def bundles(resources_json, entries_path) if entries_path.to_s == '' post('/app_stash/bundles', resources_json, @vcap_request_id).tap do |response| validate_response_code!(200, response) end else validate_file! entries_path body = { resources: UploadIO.new(StringIO.new(resources_json), 'application/json', 'resources.json'), application: UploadIO.new(entries_path, 'application/octet-stream', 'entries.zip') } multipart_post('/app_stash/bundles', body, @vcap_request_id).tap do |response| validate_response_code!(200, response) end end end |
#matches(resources_json) ⇒ Object
20 21 22 23 24 |
# File 'lib/bits_service_client/resource_pool.rb', line 20 def matches(resources_json) post('/app_stash/matches', resources_json, @vcap_request_id).tap do |response| validate_response_code!(200, response) end end |
#signed_matches_url ⇒ Object
26 27 28 |
# File 'lib/bits_service_client/resource_pool.rb', line 26 def signed_matches_url "#{@public_endpoint}#{self.sign_signature('POST','/app_stash/matches', @signed_key_secret, @signed_key_id)}" end |