Class: Files::PublicUrl
- Inherits:
-
Object
- Object
- Files::PublicUrl
- Defined in:
- lib/files.com/models/public_url.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
-
.create(path, params = {}, options = {}) ⇒ Object
Parameters: hostname (required) - string - Hostname used to request the publicly shared resource.
Instance Method Summary collapse
-
#body ⇒ Object
string - Body of the response, if a folder listing was requested.
- #body=(value) ⇒ Object
-
#cache_for_seconds ⇒ Object
int64 - Indicates how long the response should be cached, in seconds.
- #cache_for_seconds=(value) ⇒ Object
-
#download_uri ⇒ Object
string - Signed URL allowing access to the requested file.
- #download_uri=(value) ⇒ Object
-
#headers ⇒ Object
object - Used for internal url management.
- #headers=(value) ⇒ Object
-
#hostname ⇒ Object
string - Hostname used to request the publicly shared resource.
- #hostname=(value) ⇒ Object
-
#http_code ⇒ Object
int64 - Response HTTP code.
- #http_code=(value) ⇒ Object
-
#http_headers ⇒ Object
object - Headers to include with the response.
- #http_headers=(value) ⇒ Object
-
#initialize(attributes = {}, options = {}) ⇒ PublicUrl
constructor
A new instance of PublicUrl.
-
#internal_download_uri ⇒ Object
string - For use with internal services and should also be with headers and socks_ips.
- #internal_download_uri=(value) ⇒ Object
-
#mime_type ⇒ Object
string - Used for response content-type.
- #mime_type=(value) ⇒ Object
-
#path ⇒ Object
string - Path of the resource being requested.
- #path=(value) ⇒ Object
-
#redirect ⇒ Object
string - URL where this request should be redirected, if necessary.
- #redirect=(value) ⇒ Object
-
#remote_server_id ⇒ Object
int64 - Used for internal bandwidth tracking.
- #remote_server_id=(value) ⇒ Object
- #save ⇒ Object
-
#site_id ⇒ Object
int64 - Site id.
- #site_id=(value) ⇒ Object
-
#socks_ips ⇒ Object
array(string) - Used for internal url management.
- #socks_ips=(value) ⇒ Object
-
#true_path ⇒ Object
string - The actual path of the file or folder being accessed.
- #true_path=(value) ⇒ Object
-
#type ⇒ Object
string - A short string representing which error happened, if any.
- #type=(value) ⇒ Object
Constructor Details
#initialize(attributes = {}, options = {}) ⇒ PublicUrl
Returns a new instance of PublicUrl.
7 8 9 10 |
# File 'lib/files.com/models/public_url.rb', line 7 def initialize(attributes = {}, = {}) @attributes = attributes || {} @options = || {} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/files.com/models/public_url.rb', line 5 def attributes @attributes end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/files.com/models/public_url.rb', line 5 def @options end |
Class Method Details
.create(path, params = {}, options = {}) ⇒ Object
Parameters:
hostname (required) - string - Hostname used to request the publicly shared resource.
path (required) - string - Path of the resource being requested.
165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/files.com/models/public_url.rb', line 165 def self.create(path, params = {}, = {}) params ||= {} params[:path] = path raise InvalidParameterError.new("Bad parameter: hostname must be an String") if params[:hostname] and !params[:hostname].is_a?(String) raise InvalidParameterError.new("Bad parameter: path must be an String") if params[:path] and !params[:path].is_a?(String) raise MissingParameterError.new("Parameter missing: hostname") unless params[:hostname] raise MissingParameterError.new("Parameter missing: path") unless params[:path] response, = Api.send_request("/public_urls", :post, params, ) PublicUrl.new(response.data, ) end |
Instance Method Details
#body ⇒ Object
string - Body of the response, if a folder listing was requested
40 41 42 |
# File 'lib/files.com/models/public_url.rb', line 40 def body @attributes[:body] end |
#body=(value) ⇒ Object
44 45 46 |
# File 'lib/files.com/models/public_url.rb', line 44 def body=(value) @attributes[:body] = value end |
#cache_for_seconds ⇒ Object
int64 - Indicates how long the response should be cached, in seconds.
130 131 132 |
# File 'lib/files.com/models/public_url.rb', line 130 def cache_for_seconds @attributes[:cache_for_seconds] end |
#cache_for_seconds=(value) ⇒ Object
134 135 136 |
# File 'lib/files.com/models/public_url.rb', line 134 def cache_for_seconds=(value) @attributes[:cache_for_seconds] = value end |
#download_uri ⇒ Object
string - Signed URL allowing access to the requested file
49 50 51 |
# File 'lib/files.com/models/public_url.rb', line 49 def download_uri @attributes[:download_uri] end |
#download_uri=(value) ⇒ Object
53 54 55 |
# File 'lib/files.com/models/public_url.rb', line 53 def download_uri=(value) @attributes[:download_uri] = value end |
#headers ⇒ Object
object - Used for internal url management
103 104 105 |
# File 'lib/files.com/models/public_url.rb', line 103 def headers @attributes[:headers] end |
#headers=(value) ⇒ Object
107 108 109 |
# File 'lib/files.com/models/public_url.rb', line 107 def headers=(value) @attributes[:headers] = value end |
#hostname ⇒ Object
string - Hostname used to request the publicly shared resource.
139 140 141 |
# File 'lib/files.com/models/public_url.rb', line 139 def hostname @attributes[:hostname] end |
#hostname=(value) ⇒ Object
143 144 145 |
# File 'lib/files.com/models/public_url.rb', line 143 def hostname=(value) @attributes[:hostname] = value end |
#http_code ⇒ Object
int64 - Response HTTP code
13 14 15 |
# File 'lib/files.com/models/public_url.rb', line 13 def http_code @attributes[:http - code] end |
#http_code=(value) ⇒ Object
17 18 19 |
# File 'lib/files.com/models/public_url.rb', line 17 def http_code=(value) @attributes[:http - code] = value end |
#http_headers ⇒ Object
object - Headers to include with the response
31 32 33 |
# File 'lib/files.com/models/public_url.rb', line 31 def http_headers @attributes[:http_headers] end |
#http_headers=(value) ⇒ Object
35 36 37 |
# File 'lib/files.com/models/public_url.rb', line 35 def http_headers=(value) @attributes[:http_headers] = value end |
#internal_download_uri ⇒ Object
string - For use with internal services and should also be with headers and socks_ips
58 59 60 |
# File 'lib/files.com/models/public_url.rb', line 58 def internal_download_uri @attributes[:internal_download_uri] end |
#internal_download_uri=(value) ⇒ Object
62 63 64 |
# File 'lib/files.com/models/public_url.rb', line 62 def internal_download_uri=(value) @attributes[:internal_download_uri] = value end |
#mime_type ⇒ Object
string - Used for response content-type
76 77 78 |
# File 'lib/files.com/models/public_url.rb', line 76 def mime_type @attributes[:mime_type] end |
#mime_type=(value) ⇒ Object
80 81 82 |
# File 'lib/files.com/models/public_url.rb', line 80 def mime_type=(value) @attributes[:mime_type] = value end |
#path ⇒ Object
string - Path of the resource being requested.
148 149 150 |
# File 'lib/files.com/models/public_url.rb', line 148 def path @attributes[:path] end |
#path=(value) ⇒ Object
152 153 154 |
# File 'lib/files.com/models/public_url.rb', line 152 def path=(value) @attributes[:path] = value end |
#redirect ⇒ Object
string - URL where this request should be redirected, if necessary
67 68 69 |
# File 'lib/files.com/models/public_url.rb', line 67 def redirect @attributes[:redirect] end |
#redirect=(value) ⇒ Object
71 72 73 |
# File 'lib/files.com/models/public_url.rb', line 71 def redirect=(value) @attributes[:redirect] = value end |
#remote_server_id ⇒ Object
int64 - Used for internal bandwidth tracking
94 95 96 |
# File 'lib/files.com/models/public_url.rb', line 94 def remote_server_id @attributes[:remote_server_id] end |
#remote_server_id=(value) ⇒ Object
98 99 100 |
# File 'lib/files.com/models/public_url.rb', line 98 def remote_server_id=(value) @attributes[:remote_server_id] = value end |
#save ⇒ Object
156 157 158 159 160 |
# File 'lib/files.com/models/public_url.rb', line 156 def save new_obj = PublicUrl.create(path, @attributes, @options) @attributes = new_obj.attributes true end |
#site_id ⇒ Object
int64 - Site id
85 86 87 |
# File 'lib/files.com/models/public_url.rb', line 85 def site_id @attributes[:site_id] end |
#site_id=(value) ⇒ Object
89 90 91 |
# File 'lib/files.com/models/public_url.rb', line 89 def site_id=(value) @attributes[:site_id] = value end |
#socks_ips ⇒ Object
array(string) - Used for internal url management
112 113 114 |
# File 'lib/files.com/models/public_url.rb', line 112 def socks_ips @attributes[:socks_ips] end |
#socks_ips=(value) ⇒ Object
116 117 118 |
# File 'lib/files.com/models/public_url.rb', line 116 def socks_ips=(value) @attributes[:socks_ips] = value end |
#true_path ⇒ Object
string - The actual path of the file or folder being accessed. Used for caching.
121 122 123 |
# File 'lib/files.com/models/public_url.rb', line 121 def true_path @attributes[:true_path] end |
#true_path=(value) ⇒ Object
125 126 127 |
# File 'lib/files.com/models/public_url.rb', line 125 def true_path=(value) @attributes[:true_path] = value end |
#type ⇒ Object
string - A short string representing which error happened, if any
22 23 24 |
# File 'lib/files.com/models/public_url.rb', line 22 def type @attributes[:type] end |
#type=(value) ⇒ Object
26 27 28 |
# File 'lib/files.com/models/public_url.rb', line 26 def type=(value) @attributes[:type] = value end |