Class: GoApiClient::Atom::Entry

Inherits:
Object
  • Object
show all
Includes:
Helpers::SimpleAttributesSupport
Defined in:
lib/go_api_client/atom/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(root, attributes = {}) ⇒ Entry

Returns a new instance of Entry.



11
12
13
14
# File 'lib/go_api_client/atom/entry.rb', line 11

def initialize(root, attributes={})
  @root = root
  super(attributes)
end

Instance Attribute Details

#authorsObject

Returns the value of attribute authors.



7
8
9
# File 'lib/go_api_client/atom/entry.rb', line 7

def authors
  @authors
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/go_api_client/atom/entry.rb', line 7

def id
  @id
end

#pipelinesObject

Returns the value of attribute pipelines.



7
8
9
# File 'lib/go_api_client/atom/entry.rb', line 7

def pipelines
  @pipelines
end

#stage_hrefObject

Returns the value of attribute stage_href.



7
8
9
# File 'lib/go_api_client/atom/entry.rb', line 7

def stage_href
  @stage_href
end

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/go_api_client/atom/entry.rb', line 7

def title
  @title
end

#updated_atObject

Returns the value of attribute updated_at.



7
8
9
# File 'lib/go_api_client/atom/entry.rb', line 7

def updated_at
  @updated_at
end

Instance Method Details

#parse!Object



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/go_api_client/atom/entry.rb', line 16

def parse!
  self.updated_at = Time.parse(@root.xpath('xmlns:updated').first.content).utc
  self.id         = @root.xpath('xmlns:id').first.content
  self.title      = @root.xpath('xmlns:title').first.content
  self.stage_href = @root.
    xpath("xmlns:link[@type='application/vnd.go+xml' and  @rel='alternate']").
    first.
    attributes["href"].value

  self.authors    = @root.xpath('xmlns:author').collect do |author|
    Author.new(author).parse!
  end
  @root = nil
  self
end