Class: GrabzIt::Status

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Status

Returns a new instance of Status.



5
6
7
8
9
10
11
# File 'lib/grabz_it/status.rb', line 5

def initialize(xml)
  doc = REXML::Document.new(xml)
  @processing = (doc.root.elements['Processing'].text == 'True')
  @cached     = (doc.root.elements['Cached'].text == 'True')
  @expired    = (doc.root.elements['Expired'].text == 'True')
  @message    = doc.root.elements['Message'].text
end

Instance Attribute Details

#cachedObject

Returns the value of attribute cached.



3
4
5
# File 'lib/grabz_it/status.rb', line 3

def cached
  @cached
end

#expiredObject

Returns the value of attribute expired.



3
4
5
# File 'lib/grabz_it/status.rb', line 3

def expired
  @expired
end

#messageObject

Returns the value of attribute message.



3
4
5
# File 'lib/grabz_it/status.rb', line 3

def message
  @message
end

#processingObject

Returns the value of attribute processing.



3
4
5
# File 'lib/grabz_it/status.rb', line 3

def processing
  @processing
end

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/grabz_it/status.rb', line 17

def available?
  @cached
end

#failed?Boolean

Returns:

  • (Boolean)


13
14
15
# File 'lib/grabz_it/status.rb', line 13

def failed?
  !@processing && !@cached
end