Class: Twimage::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/twimage/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Image

Returns a new instance of Image.



6
7
8
9
10
11
12
13
14
# File 'lib/twimage/image.rb', line 6

def initialize(options)
  @service      = options[:service]
  @service_url  = options[:service_url]
  @image_url    = options[:image_url]
  
  extension = @image_url.match(/(\.\w+)(\?|$)/)[1]
  @tempfile = Tempfile.new(['twimage', extension])
  @tempfile << options[:image]
end

Instance Attribute Details

#image_urlObject (readonly)

Returns the value of attribute image_url.



4
5
6
# File 'lib/twimage/image.rb', line 4

def image_url
  @image_url
end

#serviceObject (readonly)

Returns the value of attribute service.



4
5
6
# File 'lib/twimage/image.rb', line 4

def service
  @service
end

#service_urlObject (readonly)

Returns the value of attribute service_url.



4
5
6
# File 'lib/twimage/image.rb', line 4

def service_url
  @service_url
end

#tempfileObject (readonly)

Returns the value of attribute tempfile.



4
5
6
# File 'lib/twimage/image.rb', line 4

def tempfile
  @tempfile
end