Class: Openlayer::S3PresignedClient
- Inherits:
-
Object
- Object
- Openlayer::S3PresignedClient
- Defined in:
- lib/openlayer/services/s3_presigned_client.rb
Instance Attribute Summary collapse
-
#payload_fields ⇒ Object
readonly
Returns the value of attribute payload_fields.
-
#presigned_url ⇒ Object
readonly
Returns the value of attribute presigned_url.
-
#s3_conn ⇒ Object
readonly
Returns the value of attribute s3_conn.
Instance Method Summary collapse
-
#initialize(presigned_url) ⇒ S3PresignedClient
constructor
A new instance of S3PresignedClient.
- #post(data) ⇒ Object
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_fields ⇒ Object (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_url ⇒ Object (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_conn ⇒ Object (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 |