diff --git a/Gemfile.lock b/Gemfile.lock index daa0fdc..89c5f71 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - lockstep_rails (0.3.79) + lockstep_rails (0.3.80) rails GEM diff --git a/app/concepts/lockstep/client.rb b/app/concepts/lockstep/client.rb index 11dc51e..b45cb0c 100644 --- a/app/concepts/lockstep/client.rb +++ b/app/concepts/lockstep/client.rb @@ -37,6 +37,20 @@ def internal_service_key RequestStore.store[:internal_service_key] end + def self.set_x_group_key(x_group_key) + RequestStore.store[:lockstep_x_group_key] = x_group_key + true + end + + def self.x_group_key + RequestStore.store[:lockstep_x_group_key] + end + + def self.set_m2m_token(token) + # this method can be ommitted and we can use directly `set_bearer_token` + set_bearer_token(token) + end + ## # Construct a new Lockstep API client targeting the specified server. # @@ -81,6 +95,10 @@ def api_key self.class.api_key end + def x_group_key + self.class.x_group_key + end + ## # Configure this API to use an application name # @@ -139,6 +157,10 @@ def request(method, path, body, params) request["Authorization"] = 'Bearer ' + bearer_token end + if x_group_key != nil + request["X-Group-Key"] = x_group_key + end + # Send the request http.request(request) end diff --git a/lib/lockstep_rails/version.rb b/lib/lockstep_rails/version.rb index e0d558e..ba5b381 100644 --- a/lib/lockstep_rails/version.rb +++ b/lib/lockstep_rails/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module LockstepRails - VERSION = '0.3.79' + VERSION = '0.3.80' end