Skip to content

Commit

Permalink
Merge pull request #57 from jekuta/56-fix-rubocop-issue
Browse files Browse the repository at this point in the history
[Closes #56] Fix some rubocop issues
  • Loading branch information
Matt Bernier authored Dec 11, 2017
2 parents 566ae9f + 661b733 commit 36df726
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ Rake::TestTask.new do |t|
t.libs << 'test'
end

desc "Run tests"
task :default => :test
desc 'Run tests'
task default: :test
2 changes: 1 addition & 1 deletion examples/example.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"Authorization": "Bearer ' + ENV['SENDGRID_API_KEY'] + '"
}
')
host = 'https://api.sendgrid.com'
host = 'https://api.sendgrid.com'
client = SendGrid::Client.new(host: host, request_headers: headers)

# GET Collection
Expand Down
12 changes: 6 additions & 6 deletions lib/ruby_http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def initialize(host: nil, request_headers: nil, version: nil, url_path: nil)
@request_headers = request_headers || {}
@version = version
@url_path = url_path || []
@methods = %w(delete get patch post put)
@methods = %w[delete get patch post put]
@query_params = nil
@request_body = nil
end
Expand Down Expand Up @@ -141,13 +141,13 @@ def build_request(name, args)
@http = add_ssl(Net::HTTP.new(uri.host, uri.port))
net_http = Kernel.const_get('Net::HTTP::' + name.to_s.capitalize)
@request = build_request_headers(net_http.new(uri.request_uri))
if (@request_body &&
(!@request_headers.has_key?('Content-Type') ||
@request_headers['Content-Type'] == 'application/json')
)
if @request_body &&
(!@request_headers.key?('Content-Type') ||
@request_headers['Content-Type'] == 'application/json')

@request.body = @request_body.to_json
@request['Content-Type'] = 'application/json'
elsif !@request_body and (name.to_s == "post")
elsif !@request_body && (name.to_s == 'post')
@request['Content-Type'] = ''
else
@request.body = @request_body
Expand Down
2 changes: 1 addition & 1 deletion ruby_http_client.gemspec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# coding: utf-8

lib = File.expand_path('../lib', __FILE__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)

Expand Down

0 comments on commit 36df726

Please sign in to comment.