Class: Upload::Response::Success
- Defined in:
- lib/upload/response/success.rb
Instance Attribute Summary collapse
-
#original_url ⇒ Object
readonly
Returns the value of attribute original_url.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(response, opts = {}) ⇒ Success
constructor
A new instance of Success.
Constructor Details
#initialize(response, opts = {}) ⇒ Success
Returns a new instance of Success.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/upload/response/success.rb', line 6 def initialize(response, opts={}) super(response, opts) # Use thumb url instead of the original one # The thumb url has fixed width for now (500px) # Will be configuarable soon. # TODO: # - Check the data field before return # - Allow user to config the size of thumb # @url = @response["data"]["thumb_url"] # carefully check the data key here # TODO: add condition to check if there is data key # @original_url = @response["data"]["img_url"] end |
Instance Attribute Details
#original_url ⇒ Object (readonly)
Returns the value of attribute original_url.
4 5 6 |
# File 'lib/upload/response/success.rb', line 4 def original_url @original_url end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
4 5 6 |
# File 'lib/upload/response/success.rb', line 4 def url @url end |