Class: Files::PublicUrl

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/public_url.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/public_url.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/public_url.rb', line 5

def options
  @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 = {}, options = {})
  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, options = Api.send_request("/public_urls", :post, params, options)
  PublicUrl.new(response.data, options)
end

Instance Method Details

#bodyObject

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_secondsObject

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_uriObject

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

#headersObject

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

#hostnameObject

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_codeObject

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_headersObject

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_uriObject

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_typeObject

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

#pathObject

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

#redirectObject

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_idObject

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

#saveObject



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_idObject

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_ipsObject

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_pathObject

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

#typeObject

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