Class: OpenBuildServiceAPI::API::About
- Inherits:
-
Object
- Object
- OpenBuildServiceAPI::API::About
- Defined in:
- lib/api/about.rb
Instance Attribute Summary collapse
-
#commit ⇒ Object
readonly
Returns the value of attribute commit.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#last_deployment ⇒ Object
readonly
Returns the value of attribute last_deployment.
-
#revision ⇒ Object
readonly
Returns the value of attribute revision.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(connection) ⇒ About
constructor
A new instance of About.
- #reload! ⇒ Object
Constructor Details
#initialize(connection) ⇒ About
Returns a new instance of About.
6 7 8 9 |
# File 'lib/api/about.rb', line 6 def initialize(connection) @connection = connection reload! end |
Instance Attribute Details
#commit ⇒ Object (readonly)
Returns the value of attribute commit.
4 5 6 |
# File 'lib/api/about.rb', line 4 def commit @commit end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
4 5 6 |
# File 'lib/api/about.rb', line 4 def description @description end |
#last_deployment ⇒ Object (readonly)
Returns the value of attribute last_deployment.
4 5 6 |
# File 'lib/api/about.rb', line 4 def last_deployment @last_deployment end |
#revision ⇒ Object (readonly)
Returns the value of attribute revision.
4 5 6 |
# File 'lib/api/about.rb', line 4 def revision @revision end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
4 5 6 |
# File 'lib/api/about.rb', line 4 def title @title end |
Instance Method Details
#reload! ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/api/about.rb', line 11 def reload! response = @connection.send_request(:get, '/about') data = Nokogiri::XML(response.body) @title = data.xpath('//about/title').text @description = data.xpath('//about/description').text @revision = data.xpath('//about/revision').text @commit = data.xpath('//about/commit').text begin @last_deployment = DateTime.parse(data.xpath('//about/last_deployment').text) rescue ArgumentError @last_deployment = nil end true end |