Class: EpoOps::Factories::RegisterSearchResultFactory
- Inherits:
-
Object
- Object
- EpoOps::Factories::RegisterSearchResultFactory
- Defined in:
- lib/epo_ops/factories/register_search_result_factory.rb
Overview
Parses the register search result from EPO Ops into an RegisterSearchResult object
Instance Attribute Summary collapse
-
#raw_data ⇒ Object
readonly
Returns the value of attribute raw_data.
Class Method Summary collapse
-
.build(raw_data) ⇒ EpoOps::RegisterSearchResult
RegisterSearchResult filled with parsed data.
Instance Method Summary collapse
-
#count ⇒ integer
The number of applications matching the query.
-
#initialize(raw_data) ⇒ RegisterSearchResultFactory
constructor
A new instance of RegisterSearchResultFactory.
-
#patents ⇒ Array
The patents returned by the search.
Constructor Details
#initialize(raw_data) ⇒ RegisterSearchResultFactory
Returns a new instance of RegisterSearchResultFactory.
22 23 24 |
# File 'lib/epo_ops/factories/register_search_result_factory.rb', line 22 def initialize(raw_data) @raw_data = raw_data end |
Instance Attribute Details
#raw_data ⇒ Object (readonly)
Returns the value of attribute raw_data.
20 21 22 |
# File 'lib/epo_ops/factories/register_search_result_factory.rb', line 20 def raw_data @raw_data end |
Class Method Details
.build(raw_data) ⇒ EpoOps::RegisterSearchResult
Returns RegisterSearchResult filled with parsed data.
9 10 11 12 13 14 15 16 17 |
# File 'lib/epo_ops/factories/register_search_result_factory.rb', line 9 def build(raw_data) factory = new(raw_data) EpoOps::RegisterSearchResult.new( factory.patents, factory.count, factory.raw_data ) end |
Instance Method Details
#count ⇒ integer
Returns The number of applications matching the query.
28 29 30 |
# File 'lib/epo_ops/factories/register_search_result_factory.rb', line 28 def count EpoOps::Util.dig(@raw_data, 'world_patent_data', 'register_search', 'total_result_count').to_i end |
#patents ⇒ Array
Returns the patents returned by the search. Patentapplication data is not complete.
34 35 36 37 38 39 |
# File 'lib/epo_ops/factories/register_search_result_factory.rb', line 34 def patents EpoOps::Util.flat_dig( @raw_data, %w[world_patent_data register_search register_documents register_document] ).map {|patent_data| EpoOps::Factories::PatentApplicationFactory.build(patent_data)} end |