Skip to content

Commit

Permalink
Add OxfordDictionary::Client#entry_snake_case
Browse files Browse the repository at this point in the history
For V2 we are going to stop snake casing the keys of the response. If
someone needs more time to upgrade their code, they can transition for
this call (which will continue to return the snake cased keys).

I plan on removing this in the next major version upgrade.
  • Loading branch information
swcraig committed Jun 22, 2019
1 parent 74d722a commit e034bd7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/oxford_dictionary/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ def entry(*args)
end
end

def entry_snake_case(word:, dataset_name: 'en-gb', params: {})
warn 'Client#entry_snake_case is DEPRECATED. Use Client#entry instead.'
entry_endpoint.
entry_snake_case(word: word, dataset_name: dataset_name, params: params)
end

private

def entry_endpoint
Expand Down
15 changes: 15 additions & 0 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,19 @@
end
end
end

describe '#entry_snake_case' do
let(:client) { described_class.new(app_id: app_id, app_key: app_key) }
subject { client.entry_snake_case(word: word, params: params) }

let(:word) { 'ace' }
let(:params) { {} }

it 'calls Entries#entry_snake_case' do
expect_any_instance_of(OxfordDictionary::Endpoints::Entries).
to receive(:entry_snake_case).
with(word: word, dataset_name: 'en-gb', params: params)
subject
end
end
end

0 comments on commit e034bd7

Please sign in to comment.