Class: GitLfsS3::UploadService::UploadRequired

Inherits:
Base
  • Object
show all
Defined in:
lib/git-lfs-s3/services/upload/upload_required.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)


8
9
10
# File 'lib/git-lfs-s3/services/upload/upload_required.rb', line 8

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

Instance Method Details

#responseObject



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/git-lfs-s3/services/upload/upload_required.rb', line 12

def response
  {
    '_links' => {
      'upload' => {
        'href' => upload_destination,
        'header' => upload_headers
      },
      'verify' => {
        'href' => File.join(server_url, 'verify')
      }
    }
  }
end

#statusObject



26
27
28
# File 'lib/git-lfs-s3/services/upload/upload_required.rb', line 26

def status
  202
end