Class: Io::Flow::V0::Models::Upload
- Inherits:
-
Object
- Object
- Io::Flow::V0::Models::Upload
- Defined in:
- lib/flow_commerce/flow_api_v0_client.rb
Overview
Provides the ability to upload a file to a URL (an expiring s3 url, usually valid for 1 week)
Instance Attribute Summary collapse
-
#expiration ⇒ Object
readonly
Returns the value of attribute expiration.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
- #copy(incoming = {}) ⇒ Object
-
#initialize(incoming = {}) ⇒ Upload
constructor
A new instance of Upload.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(incoming = {}) ⇒ Upload
Returns a new instance of Upload.
72108 72109 72110 72111 72112 72113 72114 72115 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72108 def initialize(incoming={}) opts = HttpClient::Helper.symbolize_keys(incoming) HttpClient::Preconditions.require_keys(opts, [:id, :name, :url, :expiration], 'Upload') @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String) @name = HttpClient::Preconditions.assert_class('name', opts.delete(:name), String) @url = HttpClient::Preconditions.assert_class('url', opts.delete(:url), String) @expiration = HttpClient::Preconditions.assert_class('expiration', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expiration)), DateTime) end |
Instance Attribute Details
#expiration ⇒ Object (readonly)
Returns the value of attribute expiration.
72106 72107 72108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72106 def expiration @expiration end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
72106 72107 72108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72106 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
72106 72107 72108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72106 def name @name end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
72106 72107 72108 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72106 def url @url end |
Instance Method Details
#copy(incoming = {}) ⇒ Object
72121 72122 72123 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72121 def copy(incoming={}) Upload.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming))) end |
#to_hash ⇒ Object
72125 72126 72127 72128 72129 72130 72131 72132 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72125 def to_hash { :id => id, :name => name, :url => url, :expiration => expiration } end |
#to_json ⇒ Object
72117 72118 72119 |
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 72117 def to_json JSON.dump(to_hash) end |