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 17, 2023
1 parent efeae13 commit a1a1b02
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 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.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 @@ -38,11 +38,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 @@ -8,7 +8,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, host: host) }
subject { EngagingNetworksRest::Client.new(api_key:, host:) }

describe '#pages' do
let(:page_type) { 'dcf' }
Expand Down Expand Up @@ -82,7 +82,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 @@ -96,7 +96,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 @@ -111,7 +111,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
2 changes: 1 addition & 1 deletion spec/client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
let(:api_key) { 'abc123' }
let(:content_type_header) { { 'Content-Type' => 'application/json' } }

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

describe '#authenticate!' do
let(:auth_url) { "https://#{host}/ens/service/authenticate" }
Expand Down

0 comments on commit a1a1b02

Please sign in to comment.