Class: Sp2010::FilesResponse
- Inherits:
-
Object
- Object
- Sp2010::FilesResponse
- Defined in:
- lib/sp_2010.rb
Instance Attribute Summary collapse
-
#files ⇒ Object
readonly
Returns the value of attribute files.
Instance Method Summary collapse
-
#initialize(response) ⇒ FilesResponse
constructor
A new instance of FilesResponse.
- #valid? ⇒ Boolean
Constructor Details
#initialize(response) ⇒ FilesResponse
Returns a new instance of FilesResponse.
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/sp_2010.rb', line 50 def initialize(response) if response.code == "401" @error_message = "Unauthorized access. Check your username and password." @files = [] elsif response.code == "207" @error_message = "" xml= ::Nokogiri::XML(response.body) @files = (xml).xpath("./D:multistatus/D:response").map {|node| File.new(node) } end end |
Instance Attribute Details
#files ⇒ Object (readonly)
Returns the value of attribute files.
48 49 50 |
# File 'lib/sp_2010.rb', line 48 def files @files end |
Instance Method Details
#valid? ⇒ Boolean
61 62 63 |
# File 'lib/sp_2010.rb', line 61 def valid? @error_message.empty? end |