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

Update rubocop requirement from ~> 0.50.0 to ~> 0.72.0 #140

Merged
merged 3 commits into from
Jul 10, 2019
Merged
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
5 changes: 4 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
inherit_from: .rubocop_todo.yml

AllCops:
TargetRubyVersion: 2.2
TargetRubyVersion: 2.3

Metrics/BlockLength:
ExcludedMethods: [it, describe]

Style/FrozenStringLiteralComment:
Enabled: false
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,6 @@ Style/DoubleNegation:
- 'lib/hyperclient/link.rb'

# Offense count: 1
Style/MethodMissing:
Style/MethodMissingSuper:
Exclude:
- 'lib/hyperclient/collection.rb'
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ end

group :development, :test do
gem 'rake'
gem 'rubocop', '~> 0.50.0', require: false
gem 'rubocop', '~> 0.72.0', require: false
gem 'simplecov', require: false
end

Expand Down
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/usr/bin/env rake

require 'rubygems'
require 'bundler'
Bundler.setup :default, :test, :development
Expand Down
9 changes: 4 additions & 5 deletions hyperclient.gemspec
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

require File.expand_path('../lib/hyperclient/version', __FILE__)
require File.expand_path('lib/hyperclient/version', __dir__)

Gem::Specification.new do |gem|
gem.authors = ['Oriol Gual']
Expand All @@ -14,10 +13,10 @@ Gem::Specification.new do |gem|
gem.require_paths = ['lib']
gem.version = Hyperclient::VERSION

gem.add_dependency 'addressable'
gem.add_dependency 'faraday', '>= 0.9.0'
gem.add_dependency 'faraday_middleware'
gem.add_dependency 'faraday-digestauth'
gem.add_dependency 'faraday_hal_middleware'
gem.add_dependency 'addressable'
gem.add_dependency 'faraday_middleware'
gem.add_dependency 'net-http-digest_auth'
gem.add_dependency 'faraday-digestauth'
end
3 changes: 2 additions & 1 deletion lib/hyperclient/curie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def inspect
# Returns a new expanded url.
def expand(rel)
return rel unless rel && templated?
href.gsub('{rel}', rel) if href

href&.gsub('{rel}', rel)
end
end
end
5 changes: 5 additions & 0 deletions lib/hyperclient/entry_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ def connection(options = {}, &block)
@faraday_options ||= options.dup
if block_given?
raise ConnectionAlreadyInitializedError if @connection

@faraday_block = if @faraday_options.delete(:default) == false
block
else
Expand All @@ -75,6 +76,7 @@ def connection(options = {}, &block)
# Returns a Hash.
def headers
return @connection.headers if @connection

@headers ||= default_headers
end

Expand All @@ -83,6 +85,7 @@ def headers
# value - A Hash containing headers to include with every API request.
def headers=(value)
raise ConnectionAlreadyInitializedError if @connection

@headers = value
end

Expand All @@ -98,6 +101,7 @@ def faraday_options
# value - A Hash containing options to pass to Faraday
def faraday_options=(value)
raise ConnectionAlreadyInitializedError if @connection

@faraday_options = value
end

Expand All @@ -113,6 +117,7 @@ def faraday_block
# value - A Proc accepting a Faraday::Connection.
def faraday_block=(value)
raise ConnectionAlreadyInitializedError if @connection

@faraday_block = value
end

Expand Down
5 changes: 4 additions & 1 deletion lib/hyperclient/link.rb
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def _expand(uri_variables = {})
# Public: Returns the url of the Link.
def _url
return @link['href'] unless _templated?

@url ||= _uri_template.expand(@uri_variables || {}).to_s
end

Expand Down Expand Up @@ -137,8 +138,10 @@ def method_missing(method, *args, &block)
# This allows `api.posts` instead of `api._links.posts.embedded.posts`
def delegate_method(method, *args, &block)
return unless @key && _resource.respond_to?(@key)

@delegate ||= _resource.send(@key)
return unless @delegate && @delegate.respond_to?(method.to_s)
return unless @delegate&.respond_to?(method.to_s)

@delegate.send(method, *args, &block)
end

Expand Down
4 changes: 2 additions & 2 deletions lib/hyperclient/resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,11 @@ def inspect
end

def _success?
_response && _response.success?
_response&.success?
end

def _status
_response && _response.status
_response&.status
end

def [](name)
Expand Down