Class: Sovren::Patent

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/sovren/patent.rb', line 3

def description
  @description
end

#inventor_nameObject

Returns the value of attribute inventor_name.



3
4
5
# File 'lib/sovren/patent.rb', line 3

def inventor_name
  @inventor_name
end

#patent_idObject

Returns the value of attribute patent_id.



3
4
5
# File 'lib/sovren/patent.rb', line 3

def patent_id
  @patent_id
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/sovren/patent.rb', line 3

def title
  @title
end

Class Method Details

.parse(patents) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/sovren/patent.rb', line 5

def self.parse(patents)
  return Array.new if patents.nil?
  result = patents.css('Patent').collect do |item|
    c = Patent.new
    c.title = item.css('PatentTitle').text
    c.description = item.css('Description').text
    c.inventor_name = item.css('Inventors InventorName').first.text rescue nil
    c.patent_id = item.css('PatentDetail PatentMilestone Id').text
    c
  end
  result
end