Class: Sp2010::FilesResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#filesObject (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

Returns:

  • (Boolean)


61
62
63
# File 'lib/sp_2010.rb', line 61

def valid?
  @error_message.empty?
end