Class: OpenBuildServiceAPI::API::About

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#commitObject (readonly)

Returns the value of attribute commit.



4
5
6
# File 'lib/api/about.rb', line 4

def commit
  @commit
end

#descriptionObject (readonly)

Returns the value of attribute description.



4
5
6
# File 'lib/api/about.rb', line 4

def description
  @description
end

#last_deploymentObject (readonly)

Returns the value of attribute last_deployment.



4
5
6
# File 'lib/api/about.rb', line 4

def last_deployment
  @last_deployment
end

#revisionObject (readonly)

Returns the value of attribute revision.



4
5
6
# File 'lib/api/about.rb', line 4

def revision
  @revision
end

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