Class: GitLfsS3::UploadService::ObjectExists

Inherits:
Base
  • Object
show all
Defined in:
lib/git-lfs-s3/services/upload/object_exists.rb

Instance Attribute Summary

Attributes inherited from Base

#object, #req

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#initialize

Methods included from AwsHelpers

#aws_access_key_id, #aws_region, #aws_secret_access_key, #bucket, #bucket_name, #object_data, #s3

Constructor Details

This class inherits a constructor from GitLfsS3::UploadService::Base

Class Method Details

.should_handle?(req, object) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/git-lfs-s3/services/upload/object_exists.rb', line 6

def self.should_handle?(req, object)
  object.exists? && object.size == req['size']
end

Instance Method Details

#responseObject



10
11
12
13
14
15
16
17
18
# File 'lib/git-lfs-s3/services/upload/object_exists.rb', line 10

def response
  {
    '_links' => {
      'download' => {
        'href' => object.presigned_url(:get, expires_in: 86_400)
      }
    }
  }
end

#statusObject



20
21
22
# File 'lib/git-lfs-s3/services/upload/object_exists.rb', line 20

def status
  200
end