Module: SnipSnap::Client::InstanceMethods

Defined in:
lib/snip_snap/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/snip_snap/client.rb', line 6

def url
  @url
end

Instance Method Details

#fetchObject



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/snip_snap/client.rb', line 16

def fetch
  client = Curl::Easy.new(url) do |config|
    config.follow_location = true
    config.max_redirects   = 5
    config.head            = self.class.head?
  end

  client.perform

  client
end

#image?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/snip_snap/client.rb', line 12

def image?
  true
end

#initialize(url) ⇒ Object



8
9
10
# File 'lib/snip_snap/client.rb', line 8

def initialize(url)
  @url = url
end

#responseObject



28
29
30
# File 'lib/snip_snap/client.rb', line 28

def response
  @response ||= fetch
end