Skip to content

Commit

Permalink
Add company search restrictions parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
simmerz committed Dec 9, 2024
1 parent cb06a07 commit a582392
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/companies_house/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,13 @@ def filing_history_item(id, transaction_id)
)
end

def company_search(query, items_per_page: nil, start_index: nil)
def company_search(query, items_per_page: nil, start_index: nil, restrictions: nil)
request(
resource: :company_search,
path: "search/companies",
params: {
q: query, items_per_page: items_per_page, start_index: start_index
q: query, items_per_page: items_per_page, start_index: start_index,
restrictions: restrictions,
}.compact,
)
end
Expand Down
5 changes: 4 additions & 1 deletion spec/companies_house/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@
query,
items_per_page: items_per_page,
start_index: start_index,
restrictions: restrictions,
)
end

Expand All @@ -418,16 +419,18 @@
q: query,
items_per_page: items_per_page,
start_index: start_index,
restrictions: restrictions,
}
end
let(:items_per_page) { 5 }
let(:start_index) { 3 }
let(:restrictions) { "active-companies"}

before do
stub_request(
:get,
"#{example_endpoint}/#{rest_path}?items_per_page=#{items_per_page}\
&q=#{query}&start_index=#{start_index}",
&q=#{query}&start_index=#{start_index}&restrictions=#{restrictions}",
).
with(basic_auth: [api_key, ""]).
to_return(body: '{"companies": "data"}', status: status)
Expand Down

0 comments on commit a582392

Please sign in to comment.