Class: Openlayer::S3PresignedClient

Inherits:
Object
  • Object
show all
Defined in:
lib/openlayer/services/s3_presigned_client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(presigned_url) ⇒ S3PresignedClient

Returns a new instance of S3PresignedClient.



7
8
9
10
11
12
13
14
# File 'lib/openlayer/services/s3_presigned_client.rb', line 7

def initialize(presigned_url)
  @presigned_url = presigned_url
  @payload_fields = presigned_url["fields"]
  @s3_conn = Faraday.new(url: presigned_url["url"]) do |f|
    f.request :multipart
    f.adapter :net_http
  end
end

Instance Attribute Details

#payload_fieldsObject (readonly)

Returns the value of attribute payload_fields.



5
6
7
# File 'lib/openlayer/services/s3_presigned_client.rb', line 5

def payload_fields
  @payload_fields
end

#presigned_urlObject (readonly)

Returns the value of attribute presigned_url.



5
6
7
# File 'lib/openlayer/services/s3_presigned_client.rb', line 5

def presigned_url
  @presigned_url
end

#s3_connObject (readonly)

Returns the value of attribute s3_conn.



5
6
7
# File 'lib/openlayer/services/s3_presigned_client.rb', line 5

def s3_conn
  @s3_conn
end

Instance Method Details

#post(data) ⇒ Object



16
17
18
# File 'lib/openlayer/services/s3_presigned_client.rb', line 16

def post(data)
  handle_response @s3_conn.post("/", merge_fields(data))
end