Skip to content

Commit 2b9d653

Browse files
authored
Merge pull request #61 from rosette-api/WS-2589-remove-genre-from-entities-example
WS-2589: Remove genre option from entities example
2 parents 656b221 + ae8b0a5 commit 2b9d653

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

examples/entities.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
entities_text_data = 'The Securities and Exchange Commission today announced the leadership of the agency\'s trial unit. Bridget Fitzpatrick has been named Chief Litigation Counsel of the SEC and David Gottesman will continue to serve as the agency\'s Deputy Chief Litigation Counsel. Since December 2016, Ms. Fitzpatrick and Mr. Gottesman have served as Co-Acting Chief Litigation Counsel. In that role, they were jointly responsible for supervising the trial unit at the agency\'s Washington D.C. headquarters as well as coordinating with litigators in the SEC\'s 11 regional offices around the country.'
1414
begin
15-
params = DocumentParameters.new(content: entities_text_data,
16-
genre: 'social-media')
15+
params = DocumentParameters.new(content: entities_text_data)
1716
response = rosette_api.get_entities(params)
1817
puts JSON.pretty_generate(response)
1918
rescue RosetteAPIError => e

lib/rosette_api.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
require_relative 'rosette_api_error'
1010
require_relative 'bad_request_error'
1111
require_relative 'bad_request_format_error'
12+
require 'logger'
13+
14+
1215

1316
# This class allows you to access all Rosette API endpoints.
1417
class RosetteAPI
@@ -65,6 +68,7 @@ class RosetteAPI
6568
attr_accessor :url_parameters
6669

6770
def initialize(user_key, alternate_url = 'https://api.rosette.com/rest/v1')
71+
@log = Logger.new(STDOUT)
6872
@user_key = user_key
6973
@alternate_url = alternate_url
7074
@url_parameters = nil
@@ -530,5 +534,8 @@ def check_params(params,
530534
message = 'Expects a DocumentParameters type as an argument',
531535
type = DocumentParameters)
532536
raise BadRequestError.new message unless params.is_a? type
537+
if defined?(params.genre) && !params.genre.nil?
538+
@log.warn("The genre parameter is deprecated and will be removed in a future release.")
539+
end
533540
end
534541
end

0 commit comments

Comments
 (0)