rospatent 1.1.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -41,14 +41,14 @@ module Rospatent
41
41
  # @param qn [String] Natural language search query
42
42
  # @param limit [Integer] Maximum number of results to return
43
43
  # @param offset [Integer] Offset for pagination
44
- # @param pre_tag [String] HTML tag to prepend to highlighted matches
45
- # @param post_tag [String] HTML tag to append to highlighted matches
44
+ # @param pre_tag [String, Array<String>] HTML tag(s) to prepend to highlighted matches
45
+ # @param post_tag [String, Array<String>] HTML tag(s) to append to highlighted matches
46
46
  # @param sort [Symbol, String] Sort option (:relevance, :pub_date, :filing_date)
47
- # @param group_by [Symbol, String] Grouping option (:patent_family)
47
+ # @param group_by [String] Grouping option ("family:docdb", "family:dwpi")
48
48
  # @param include_facets [Boolean] Whether to include facet information
49
49
  # @param filter [Hash] Filters to apply to the search
50
50
  # @param datasets [Array<String>] Datasets to search within
51
- # @param highlight [Boolean] Whether to highlight matches
51
+ # @param highlight [Hash] Advanced highlight configuration with profiles
52
52
  #
53
53
  # @return [Rospatent::SearchResult] Search result object
54
54
  def execute(
@@ -111,31 +111,35 @@ module Rospatent
111
111
  end
112
112
 
113
113
  # Validate highlighting parameters (only if provided)
114
- if params.key?(:highlight)
115
- validated[:highlight] = !!params[:highlight]
116
- if params[:highlight] && params[:pre_tag]
117
- validated[:pre_tag] =
118
- validate_string(params[:pre_tag], "pre_tag", max_length: 50)
119
- end
120
- if params[:highlight] && params[:post_tag]
121
- validated[:post_tag] =
122
- validate_string(params[:post_tag], "post_tag", max_length: 50)
114
+ # pre_tag and post_tag must be provided together
115
+ if params[:pre_tag] || params[:post_tag]
116
+ unless params[:pre_tag] && params[:post_tag]
117
+ raise Errors::ValidationError,
118
+ "Both pre_tag and post_tag must be provided together for highlighting"
123
119
  end
120
+
121
+ validated[:pre_tag] =
122
+ validate_string_or_array(params[:pre_tag], "pre_tag", max_length: 50, max_size: 10)
123
+ validated[:post_tag] =
124
+ validate_string_or_array(params[:post_tag], "post_tag", max_length: 50, max_size: 10)
124
125
  end
125
126
 
127
+ # Validate highlight parameter (complex object for advanced highlighting)
128
+ validated[:highlight] = validate_hash(params[:highlight], "highlight") if params[:highlight]
129
+
126
130
  # Validate sort parameter (only if provided)
127
131
  validated[:sort] = validate_sort_parameter(params[:sort]) if params[:sort]
128
132
 
129
133
  # Validate group_by parameter (only if provided)
130
134
  if params[:group_by]
131
- validated[:group_by] = validate_enum(params[:group_by], [:patent_family], "group_by")
135
+ validated[:group_by] = validate_string_enum(params[:group_by], %w[family:docdb family:dwpi], "group_by")
132
136
  end
133
137
 
134
138
  # Validate boolean parameters (only if provided)
135
139
  validated[:include_facets] = !params[:include_facets].nil? if params.key?(:include_facets)
136
140
 
137
141
  # Validate filter parameter
138
- validated[:filter] = validate_hash(params[:filter], "filter") if params[:filter]
142
+ validated[:filter] = validate_filter(params[:filter], "filter") if params[:filter]
139
143
 
140
144
  # Validate datasets parameter
141
145
  if params[:datasets]
@@ -161,18 +165,20 @@ module Rospatent
161
165
  payload[:limit] = params[:limit] if params[:limit]
162
166
  payload[:offset] = params[:offset] if params[:offset]
163
167
 
164
- # Add highlighting parameters (only if explicitly provided)
165
- if params.key?(:highlight)
166
- payload[:highlight] = params[:highlight]
167
- payload[:pre_tag] = params[:pre_tag] if params[:pre_tag]
168
- payload[:post_tag] = params[:post_tag] if params[:post_tag]
168
+ # Add highlighting tags (only if both are provided)
169
+ if params[:pre_tag] && params[:post_tag]
170
+ payload[:pre_tag] = params[:pre_tag]
171
+ payload[:post_tag] = params[:post_tag]
169
172
  end
170
173
 
174
+ # Add advanced highlight parameter (independent of tags)
175
+ payload[:highlight] = params[:highlight] if params[:highlight]
176
+
171
177
  # Add sort parameter (only if explicitly provided)
172
178
  payload[:sort] = params[:sort] if params[:sort]
173
179
 
174
180
  # Add grouping parameter (only if explicitly provided)
175
- payload[:group_by] = "patent_family" if params[:group_by] == :patent_family
181
+ payload[:group_by] = params[:group_by] if params[:group_by]
176
182
 
177
183
  # Add other parameters (only if explicitly provided)
178
184
  payload[:include_facets] = params[:include_facets] if params.key?(:include_facets)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rospatent
4
- VERSION = "1.1.0"
4
+ VERSION = "1.3.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rospatent
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aleksandr Dryzhuk
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2025-06-04 00:00:00.000000000 Z
11
+ date: 2025-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -72,42 +72,42 @@ dependencies:
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '1.59'
75
+ version: '1.76'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '1.59'
82
+ version: '1.76'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop-minitest
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: '0.34'
89
+ version: '0.38'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: '0.34'
96
+ version: '0.38'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop-rake
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
101
  - - "~>"
102
102
  - !ruby/object:Gem::Version
103
- version: '0.6'
103
+ version: '0.7'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
108
  - - "~>"
109
109
  - !ruby/object:Gem::Version
110
- version: '0.6'
110
+ version: '0.7'
111
111
  description: A comprehensive Ruby client for interacting with the Rospatent patent
112
112
  search API. Features include automatic caching, request validation, structured logging,
113
113
  error handling, and batch operations for efficient patent data retrieval.
@@ -140,8 +140,8 @@ licenses:
140
140
  metadata:
141
141
  homepage_uri: https://github.com/amdest/rospatent
142
142
  source_code_uri: https://github.com/amdest/rospatent
143
- changelog_uri: https://github.com/amdest/rospatent/blob/main/CHANGELOG.md
144
- documentation_uri: https://github.com/amdest/rospatent/blob/main/README.md
143
+ changelog_uri: https://github.com/amdest/rospatent/blob/master/CHANGELOG.md
144
+ documentation_uri: https://github.com/amdest/rospatent/blob/master/README.md
145
145
  bug_tracker_uri: https://github.com/amdest/rospatent/issues
146
146
  wiki_uri: https://github.com/amdest/rospatent/wiki
147
147
  rubygems_mfa_required: 'true'