module RelinkApi
Constants
- API_BASE_URL
- VERSION
Attributes
config[RW]
Public Class Methods
authenticate()
click to toggle source
# File lib/relink_api.rb, line 14 def self.authenticate raise MissingAPICredentials unless self.config self.config.api_key && self.config.api_secret && self.config.account_id self.client.authenticate end
authentication_header()
click to toggle source
# File lib/relink_api.rb, line 23 def self.authentication_header raise NotAuthorized unless client.token { "Authorization" => "Bearer #{client.token}", "Content-Type" => "application/json", "Accept" => "application/json" } end
client()
click to toggle source
# File lib/relink_api.rb, line 31 def self.client @client ||= Client.new @client end
configure() { |config| ... }
click to toggle source
# File lib/relink_api/configuration.rb, line 9 def self.configure self.config ||= Configuration.new yield(config) end
Protected Class Methods
camelize_params(params)
click to toggle source
# File lib/relink_api.rb, line 44 def self.camelize_params(params) new_params = {} params.each do |key, value| new_value = value.is_a?(Hash) ? camelize_params(value) : value new_params[key.to_s.camelizify] = new_value end new_params end
check_params_presence(present:, required:)
click to toggle source
# File lib/relink_api.rb, line 38 def self.check_params_presence(present:, required:) required.each do |key| raise "#{key} key missing" unless present.has_key?(key) end end
transform_params(params)
click to toggle source
# File lib/relink_api.rb, line 55 def self.transform_params(params) params.merge({"accountId": RelinkApi.config.account_id}) .deep_stringify_keys .deep_camelize_keys end