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)


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

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

Instance Method Details

#responseObject



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

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

#statusObject



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

def status
  200
end