From cd1882a57e6d1a1571e61022e878fb75ea427a8c Mon Sep 17 00:00:00 2001 From: Grey Moore Date: Mon, 16 Oct 2023 16:30:59 -0400 Subject: [PATCH] hash shorthand syntax --- lib/engaging_networks_rest.rb | 2 +- lib/engaging_networks_rest/client.rb | 4 ++-- spec/client/pages_spec.rb | 8 ++++---- spec/client_spec.rb | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/engaging_networks_rest.rb b/lib/engaging_networks_rest.rb index 96094d7..3725c96 100644 --- a/lib/engaging_networks_rest.rb +++ b/lib/engaging_networks_rest.rb @@ -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 diff --git a/lib/engaging_networks_rest/client.rb b/lib/engaging_networks_rest/client.rb index 611d926..acfdd2d 100644 --- a/lib/engaging_networks_rest/client.rb +++ b/lib/engaging_networks_rest/client.rb @@ -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 diff --git a/spec/client/pages_spec.rb b/spec/client/pages_spec.rb index 4d1c509..53ea3ea 100644 --- a/spec/client/pages_spec.rb +++ b/spec/client/pages_spec.rb @@ -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' } @@ -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 }, @@ -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' @@ -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 diff --git a/spec/client_spec.rb b/spec/client_spec.rb index ea95bdf..8ae91c1 100644 --- a/spec/client_spec.rb +++ b/spec/client_spec.rb @@ -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" }