Class: AdGear::Upload
- Inherits:
-
Base
- Object
- ActiveResource::Base
- Base
- AdGear::Upload
show all
- Defined in:
- lib/ad_gear/upload.rb
Instance Method Summary
collapse
Methods inherited from Base
belongs_to, belongs_to_associations, #encode, has_many, has_many_collections, ignorable_attributes, #initialize, #to_xml
Constructor Details
This class inherits a constructor from AdGear::Base
Instance Method Details
#save ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/ad_gear/upload.rb', line 11
def save
retried = false
= Hash.new
begin
uri = self.class.site.merge(URI.parse(self.class.collection_path))
params = {"upload[uploaded_data]" => ::File.new(attributes["filename"]), "upload[filename]" => ::File.basename(attributes["filename"])}
out = RestClient.post(uri.to_s, params, )
logger.debug out if logger
load(connection.format.decode(out))
rescue RestClient::Unauthorized => e
raise if retried
www_authenticate = e.response["www-authenticate"]
= ActiveResource::Digest.authenticate(uri, self.class.user, self.class.password, www_authenticate, :post)
["Authorization"] =
retried = true
retry
end
end
|
#update_attribute(*args) ⇒ Object
33
34
35
|
# File 'lib/ad_gear/upload.rb', line 33
def update_attribute(*args)
raise_unsupported_operation
end
|
#update_attributes(*args) ⇒ Object
37
38
39
|
# File 'lib/ad_gear/upload.rb', line 37
def update_attributes(*args)
raise_unsupported_operation
end
|