encoded_attachment 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
data/lib/activeresource/base.rb
CHANGED
@@ -74,8 +74,9 @@ module EncodedAttachment
|
|
74
74
|
changed = (changed.nil? || changed) ? true : false
|
75
75
|
if file_url
|
76
76
|
url = URI.parse(file_url.to_s)
|
77
|
+
send "#{name}_content_type=", MIME::Types.type_for(File.basename(url.path)).first.content_type
|
77
78
|
send "#{name}=", StringIO.new(connection.get_attachment(url.path,
|
78
|
-
'Accept' => send("#{name}_content_type"))
|
79
|
+
'Accept' => send("#{name}_content_type"))), changed
|
79
80
|
send "#{name}_file_name=", File.basename(url.path)
|
80
81
|
send "#{name}_content_type=", MIME::Types.type_for(File.basename(url.path)).first.content_type
|
81
82
|
else
|
@@ -1,8 +1,7 @@
|
|
1
1
|
module EncodedAttachment
|
2
2
|
module ActiveResourceConnectionMethods
|
3
3
|
def get_attachment(path, headers = {})
|
4
|
-
|
5
|
-
with_auth { request(:get, path, request_headers) }
|
4
|
+
with_auth { request(:get, path, build_request_headers(headers, :get, self.site.merge(path))).body }
|
6
5
|
end
|
7
6
|
end
|
8
7
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: encoded_attachment
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 6
|
10
|
+
version: 0.1.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Nick Ragaz
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-06-
|
18
|
+
date: 2010-06-16 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|