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 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
- Dir.glob('./twimage/*').each { |r| require r }
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
- puts response.code
8
+ @extension = @image_url.match(/(\.\w+)(\?|$)/)[1]
9
9
  if response.code == 200
10
- @tempfile = Tempfile.new(['twimage','.jpg'])
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)"
@@ -1,3 +1,3 @@
1
1
  module Twimage
2
- VERSION = "0.0.10"
2
+ VERSION = "0.0.11"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: twimage
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.10
5
+ version: 0.0.11
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rob Cameron