Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ruby2_keywords for ruby 3 compatibility (#109) #110

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ end

group :development, :test do
gem 'rake', '~> 13.2.1'
gem 'ruby2_keywords'
end

group :test do
Expand Down
3 changes: 2 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ DEPENDENCIES
rack-test (~> 2)
rake (~> 13.2.1)
redcarpet (~> 3.6.0)
ruby2_keywords
simplecov (~> 0.22.0)

BUNDLED WITH
2.4.14
2.4.22
3 changes: 2 additions & 1 deletion lib/looker-sdk.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

#require 'rack'
#require 'rack/mock_response'
require 'ruby2_keywords'

require 'looker-sdk/client'
require 'looker-sdk/default'
Expand All @@ -74,7 +75,7 @@ def respond_to?(method_name, include_private=false); client.respond_to?(method_n

private

def method_missing(method_name, *args, &block)
ruby2_keywords def method_missing(method_name, *args, &block)
return super unless client.respond_to?(method_name)
client.send(method_name, *args, &block)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/looker-sdk/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
require 'looker-sdk/rate_limit'
require 'looker-sdk/client/dynamic'
require 'looker-sdk/error'
require 'ruby2_keywords'

module LookerSDK

Expand Down Expand Up @@ -293,7 +294,7 @@ def client_secret=(value)
# LOOKER_SILENT is set to true.
#
# @return [nil]
def looker_warn(*message)
ruby2_keywords def looker_warn(*message)
unless ENV['LOOKER_SILENT']
warn message
end
Expand Down
8 changes: 5 additions & 3 deletions lib/looker-sdk/client/dynamic.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
# THE SOFTWARE.
############################################################################################

require 'ruby2_keywords'

module LookerSDK
class Client

Expand Down Expand Up @@ -97,12 +99,12 @@ def method_link(entry)
# Callers can explicitly 'invoke' remote methods or let 'method_missing' do the trick.
# If nothing else, this gives clients a way to deal with potential conflicts between remote method
# names and names of methods on client itself.
def invoke(method_name, *args, &block)
ruby2_keywords def invoke(method_name, *args, &block)
entry = find_entry(method_name) || raise(NameError, "undefined remote method '#{method_name}'")
invoke_remote(entry, method_name, *args, &block)
end

def method_missing(method_name, *args, &block)
ruby2_keywords def method_missing(method_name, *args, &block)
entry = find_entry(method_name) || (return super)
invoke_remote(entry, method_name, *args, &block)
end
Expand All @@ -117,7 +119,7 @@ def find_entry(method_name)
operations && operations[method_name.to_sym] if dynamic
end

def invoke_remote(entry, method_name, *args, &block)
ruby2_keywords def invoke_remote(entry, method_name, *args, &block)
args = (args || []).dup
route = entry[:route].to_s.dup
params = (entry[:info][:parameters] || []).select {|param| param[:in] == 'path'}
Expand Down
2 changes: 1 addition & 1 deletion lib/looker-sdk/default.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ module LookerSDK
module Default

# Default API endpoint look TODO update this as needed
API_ENDPOINT = "https://localhost:19999/api/3.0/".freeze
API_ENDPOINT = "https://localhost:19999/api/4.0/".freeze

# Default User Agent header string
USER_AGENT = "Looker Ruby Gem #{LookerSDK::VERSION}".freeze
Expand Down
Loading