Class: Autility::Document
- Inherits:
-
Object
- Object
- Autility::Document
- Defined in:
- lib/autility/data.rb,
lib/autility/document.rb
Overview
Public: Represents a remote document we are interested in.
Examples
document = Document.new(url, :post, , params)
document.save("~/utilities/endesa_11_2012.pdf")
Instance Attribute Summary collapse
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, method = :get, cookie = nil, params = {}) ⇒ Document
constructor
Public: Initializes a new document.
-
#save(path) ⇒ Object
Public: Fetches the document and saves it to a particular path.
Constructor Details
#initialize(url, method = :get, cookie = nil, params = {}) ⇒ Document
Public: Initializes a new document.
url - The String url where we can get the document method - The String HTTP method to use. cookie - the session Cookie needed to access the url params - The Array of POST params needed to fetch it
15 16 17 18 19 |
# File 'lib/autility/data.rb', line 15 def initialize(url, params, ) @url = url @params = params @cookie = end |
Instance Attribute Details
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie.
10 11 12 |
# File 'lib/autility/document.rb', line 10 def @cookie end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
10 11 12 |
# File 'lib/autility/document.rb', line 10 def params @params end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
10 11 12 |
# File 'lib/autility/document.rb', line 10 def url @url end |
Instance Method Details
#save(path) ⇒ Object
Public: Fetches the document and saves it to a particular path.
path - The String path where we will save the document.
Returns nothing.
30 31 32 33 |
# File 'lib/autility/document.rb', line 30 def save(path) command = Command.build(@url, @method, @cookie, @params, path) system(command) end |