Class: Gazette::Response::Success

Inherits:
Gazette::Response show all
Defined in:
lib/gazette/response/success.rb

Overview

Successful response from the Instapaper API

Author:

  • Jeff Pollard

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Success

Create a new Success object out of a net/http response.



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gazette/response/success.rb', line 18

def initialize(response)
  unless response.is_a?(Net::HTTPResponse)
    # Require a net/http response object
    raise ArgumentError.new("Argument must be a Net::HTTPResponse object") 
  end
  
  # Build our ivars from the response and headers
  @body = response.body
  @content_location = response.header['Content-Location']
  @instapaper_title = response.header['X-Instapaper-Title']
end

Instance Attribute Details

#bodyObject (readonly)

The body returned by the Instapaper API



15
16
17
# File 'lib/gazette/response/success.rb', line 15

def body
  @body
end

#content_locationObject (readonly)

Final saved URL of the content returned from the Instapaper API.



9
10
11
# File 'lib/gazette/response/success.rb', line 9

def content_location
  @content_location
end

#instapaper_titleObject (readonly)

Saved title of the content returned from the Instapaper API.



12
13
14
# File 'lib/gazette/response/success.rb', line 12

def instapaper_title
  @instapaper_title
end