Class: VzaarApi::Signature::Abstract
- Inherits:
-
Object
- Object
- VzaarApi::Signature::Abstract
- Includes:
- Lib::HasResourceUrl
- Defined in:
- lib/vzaar_api/signature/abstract.rb
Direct Known Subclasses
Constant Summary collapse
- X_AMZ_HEADERS =
[ "x-amz-credential", "x-amz-algorithm", "x-amz-date", "x-amz-signature" ]
Instance Attribute Summary collapse
-
#access_key_id ⇒ Object
readonly
Returns the value of attribute access_key_id.
-
#acl ⇒ Object
readonly
Returns the value of attribute acl.
-
#bucket ⇒ Object
readonly
Returns the value of attribute bucket.
-
#content_type ⇒ Object
readonly
Returns the value of attribute content_type.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#policy ⇒ Object
readonly
Returns the value of attribute policy.
-
#success_action_status ⇒ Object
readonly
Returns the value of attribute success_action_status.
-
#upload_hostname ⇒ Object
readonly
Returns the value of attribute upload_hostname.
-
#x_amz_headers ⇒ Object
readonly
Returns the value of attribute x_amz_headers.
Class Method Summary collapse
Instance Method Summary collapse
- #after_initialize(attrs = {}) ⇒ Object
- #build_x_amz_headers(attrs) ⇒ Object
-
#initialize(attrs = {}) ⇒ Abstract
constructor
A new instance of Abstract.
- #multipart? ⇒ Boolean
Methods included from Lib::HasResourceUrl
Constructor Details
#initialize(attrs = {}) ⇒ Abstract
Returns a new instance of Abstract.
19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/vzaar_api/signature/abstract.rb', line 19 def initialize(attrs = {}) @access_key_id = attrs[:access_key_id] @acl = attrs[:acl] @bucket = attrs[:bucket] @guid = attrs[:guid] @key = attrs[:key] @policy = attrs[:policy] @success_action_status = attrs[:success_action_status] @upload_hostname = attrs[:upload_hostname] @x_amz_headers = build_x_amz_headers(attrs) after_initialize(attrs) end |
Instance Attribute Details
#access_key_id ⇒ Object (readonly)
Returns the value of attribute access_key_id.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def access_key_id @access_key_id end |
#acl ⇒ Object (readonly)
Returns the value of attribute acl.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def acl @acl end |
#bucket ⇒ Object (readonly)
Returns the value of attribute bucket.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def bucket @bucket end |
#content_type ⇒ Object (readonly)
Returns the value of attribute content_type.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def content_type @content_type end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def guid @guid end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def key @key end |
#policy ⇒ Object (readonly)
Returns the value of attribute policy.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def policy @policy end |
#success_action_status ⇒ Object (readonly)
Returns the value of attribute success_action_status.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def success_action_status @success_action_status end |
#upload_hostname ⇒ Object (readonly)
Returns the value of attribute upload_hostname.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def upload_hostname @upload_hostname end |
#x_amz_headers ⇒ Object (readonly)
Returns the value of attribute x_amz_headers.
7 8 9 |
# File 'lib/vzaar_api/signature/abstract.rb', line 7 def x_amz_headers @x_amz_headers end |
Class Method Details
.create(attrs = {}) ⇒ Object
40 41 42 43 |
# File 'lib/vzaar_api/signature/abstract.rb', line 40 def self.create(attrs = {}) attrs[:uploader] = UPLOADER new Lib::Api.new.post(resource_url, attrs).data end |
Instance Method Details
#after_initialize(attrs = {}) ⇒ Object
32 33 34 |
# File 'lib/vzaar_api/signature/abstract.rb', line 32 def after_initialize(attrs = {}) raise Error.new('Cannot call #after_initialize on Signature::Abstract') end |
#build_x_amz_headers(attrs) ⇒ Object
45 46 47 48 49 50 |
# File 'lib/vzaar_api/signature/abstract.rb', line 45 def build_x_amz_headers(attrs) X_AMZ_HEADERS.reduce({}) do |col, key| col[key] = attrs[key.to_sym] col end end |
#multipart? ⇒ Boolean
36 37 38 |
# File 'lib/vzaar_api/signature/abstract.rb', line 36 def multipart? raise Error.new('Cannot call #multipart? on Signature::Abstract') end |