twimage 0.0.10 → 0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/twimage.rb +3 -1
- data/lib/twimage/base.rb +3 -3
- data/lib/twimage/version.rb +1 -1
- metadata +1 -1
data/lib/twimage.rb
CHANGED
@@ -5,8 +5,10 @@ require 'tempfile'
|
|
5
5
|
|
6
6
|
$:.unshift(File.dirname(__FILE__)) unless $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
|
7
7
|
|
8
|
+
require 'twimage/version'
|
8
9
|
require 'twimage/base'
|
9
|
-
|
10
|
+
require 'twimage/twitpic'
|
11
|
+
require 'twimage/yfrog'
|
10
12
|
|
11
13
|
module Twimage
|
12
14
|
|
data/lib/twimage/base.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module Twimage
|
2
2
|
class Base
|
3
3
|
|
4
|
-
attr_accessor :tempfile, :image_url, :service_url
|
4
|
+
attr_accessor :tempfile, :image_url, :service_url, :extension
|
5
5
|
|
6
6
|
def initialize(service_url)
|
7
7
|
response = HTTParty.get(@image_url)
|
8
|
-
|
8
|
+
@extension = @image_url.match(/(\.\w+)(\?|$)/)[1]
|
9
9
|
if response.code == 200
|
10
|
-
@tempfile = Tempfile.new(['twimage'
|
10
|
+
@tempfile = Tempfile.new(['twimage',@extension])
|
11
11
|
@tempfile << response.body.force_encoding('utf-8')
|
12
12
|
else
|
13
13
|
raise ImageURLInvalid, "The image_url #{@image_url} was not found (returned a 404)"
|
data/lib/twimage/version.rb
CHANGED