Skip to content

Commit

Permalink
hash shorthand syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
lavaturtle committed Oct 16, 2023
1 parent af3d48d commit 1be2b6f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion lib/engaging_networks_rest.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
module EngagingNetworksRest
class << self
def new(api_key:, host: EngagingNetworksRest::Client::ENS_DOMAIN)
EngagingNetworksRest::Client.new(api_key: api_key, host: host)
EngagingNetworksRest::Client.new(api_key:, host:)
end
end
end
4 changes: 2 additions & 2 deletions lib/engaging_networks_rest/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def authenticated?
end

def get(path:, params: {})
request(method: :get, path: path, params: params)
request(method: :get, path:, params:)
end

def post(path:, body: {})
request(method: :post, path: path, body: body)
request(method: :post, path:, body:)
end

include EngagingNetworksRest::Client::Pages
Expand Down
8 changes: 4 additions & 4 deletions spec/client/pages_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:ens_auth_key) { 'tmp-auth-key-456' }
let(:standard_headers) { { 'Content-Type' => 'application/json', 'Ens-Auth-Token' => ens_auth_key } }

subject { EngagingNetworksRest::Client.new(api_key: api_key) }
subject { EngagingNetworksRest::Client.new(api_key:) }

describe '#pages' do
let(:page_type) { 'dcf' }
Expand Down Expand Up @@ -81,7 +81,7 @@
headers: { content_type: 'application/json; charset=utf-8' },
body: response.to_json)

subject.process_page_request(page_id: page_id,
subject.process_page_request(page_id:,
generic_data: { 'txn1' => 'foo',
'txn2' => 'bar',
'suppressAutoResponder' => true },
Expand All @@ -95,7 +95,7 @@
headers: { content_type: 'application/json; charset=utf-8' },
body: response.to_json)

result = subject.process_page_request(page_id: page_id, supporter_data: supporter_hash)
result = subject.process_page_request(page_id:, supporter_data: supporter_hash)

expect(result['id']).to eq '1234567'
expect(result['supporterId']).to eq '98765'
Expand All @@ -110,7 +110,7 @@
body: failure_response.to_json)

expect do
subject.process_page_request(page_id: page_id,
subject.process_page_request(page_id:,
supporter_data: supporter_hash)
end.to raise_error(RuntimeError, /Unexpected 'status' value on response.*Something went wrong/)
end
Expand Down
4 changes: 2 additions & 2 deletions spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
let(:api_key) { 'abc123' }
let(:content_type_header) { { 'Content-Type' => 'application/json' } }

subject { EngagingNetworksRest::Client.new(api_key: api_key) }
subject { EngagingNetworksRest::Client.new(api_key:) }

describe '#authenticate!' do
let(:auth_key) { '75491e42-99dc-45ce-b637-a681bede875c' }
Expand All @@ -32,7 +32,7 @@
let(:host) { 'example.com' }
let(:auth_url) { "https://#{host}/ens/service/authenticate" }

subject { EngagingNetworksRest::Client.new(api_key: api_key, host: host) }
subject { EngagingNetworksRest::Client.new(api_key:, host:) }

it 'should set the ens_auth_key on the client' do
subject.authenticate!
Expand Down

0 comments on commit 1be2b6f

Please sign in to comment.