Skip to content

Commit

Permalink
switch access modifiers to outdent, fix indentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewshafer committed Mar 17, 2014
1 parent e178615 commit a08b842
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 178 deletions.
2 changes: 2 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
AccessModifierIndentation:
EnforcedStyle: outdent
EmptyLinesAroundBody:
Enabled: false
LineLength:
Expand Down
16 changes: 8 additions & 8 deletions lib/tankard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ def respond_to?(method)
client.respond_to?(method)
end

private
private

def method_missing(method_name, *args, &block)
return super unless client.respond_to?(method_name)
client.send(method_name, *args, &block)
end
def method_missing(method_name, *args, &block)
return super unless client.respond_to?(method_name)
client.send(method_name, *args, &block)
end

def reset_client
@client.value = nil
end
def reset_client
@client.value = nil
end
end
end
38 changes: 19 additions & 19 deletions lib/tankard/api/beer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,32 +102,32 @@ def params(options = {})
self
end

private
private

def http_request_uri
endpoint = "#{route}/#{raise_if_no_id_in_options}"
def http_request_uri
endpoint = "#{route}/#{raise_if_no_id_in_options}"

endpoint += "/#{@options.delete(:endpoint)}" if @options.endpoint?
endpoint += "/#{@options.delete(:endpoint)}" if @options.endpoint?

endpoint
end
endpoint
end

def raise_if_no_id_in_options
fail Tankard::Error::MissingParameter, 'No Beer ID is set' unless @options.id?
@options.delete(:id)
end
def raise_if_no_id_in_options
fail Tankard::Error::MissingParameter, 'No Beer ID is set' unless @options.id?
@options.delete(:id)
end

def route
'beer'
end
def route
'beer'
end

def http_client
@request
end
def http_client
@request
end

def http_request_parameters
@options
end
def http_request_parameters
@options
end
end
end
end
20 changes: 10 additions & 10 deletions lib/tankard/api/beers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ def params(options = {})
self
end

private
private

def http_request_uri
'beers'
end
def http_request_uri
'beers'
end

def http_client
@request
end
def http_client
@request
end

def http_request_parameters
@options
end
def http_request_parameters
@options
end
end
end
end
26 changes: 13 additions & 13 deletions lib/tankard/api/request/get.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@ module Api
module Request
module Get

private
private

def request_data_with_nil_on_http_error(request_object, uri, options)
request_data(request_object, uri, options)
rescue Tankard::Error::HttpError
nil
end
def request_data_with_nil_on_http_error(request_object, uri, options)
request_data(request_object, uri, options)
rescue Tankard::Error::HttpError
nil
end

# break up the request methods into smaller pieces
def request_data(request_object, uri, options)
get_request(request_object, uri, options)['data']
end
# break up the request methods into smaller pieces
def request_data(request_object, uri, options)
get_request(request_object, uri, options)['data']
end

def get_request(request_object, uri, options)
request_object.get(uri, options)
end
def get_request(request_object, uri, options)
request_object.get(uri, options)
end
end
end
end
Expand Down
42 changes: 21 additions & 21 deletions lib/tankard/api/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -97,34 +97,34 @@ def geo_point(latitude, longitude)
self
end

private
private

def http_request_uri
endpoint = 'search'
def http_request_uri
endpoint = 'search'

endpoint += "/#{@options.delete(:endpoint)}" if @options.endpoint?
endpoint += "/#{@options.delete(:endpoint)}" if @options.endpoint?

endpoint
end
endpoint
end

def http_client
@request
end
def http_client
@request
end

def http_request_parameters
@options
end
def http_request_parameters
@options
end

def raise_if_required_options_not_set
case @options.endpoint
when nil
fail Tankard::Error::MissingParameter, 'No search query set' unless @options.q?
when 'upc'
fail Tankard::Error::MissingParameter, 'missing parameter: code' unless @options.code?
when 'geo/point'
fail Tankard::Error::MissingParameter, 'missing Parameters: lat, lng' unless @options.lat? && @options.lng?
end
def raise_if_required_options_not_set
case @options.endpoint
when nil
fail Tankard::Error::MissingParameter, 'No search query set' unless @options.q?
when 'upc'
fail Tankard::Error::MissingParameter, 'missing parameter: code' unless @options.code?
when 'geo/point'
fail Tankard::Error::MissingParameter, 'missing Parameters: lat, lng' unless @options.lat? && @options.lng?
end
end
end
end
end
34 changes: 17 additions & 17 deletions lib/tankard/api/style.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,28 +53,28 @@ def id(style_id)
self
end

private
private

def raise_if_no_id_in_options
fail Tankard::Error::MissingParameter, 'No style id set' unless @options.id?
@options.delete(:id)
end
def raise_if_no_id_in_options
fail Tankard::Error::MissingParameter, 'No style id set' unless @options.id?
@options.delete(:id)
end

def route
'style'
end
def route
'style'
end

def http_request_uri
"#{route}/#{raise_if_no_id_in_options}"
end
def http_request_uri
"#{route}/#{raise_if_no_id_in_options}"
end

def http_client
@request
end
def http_client
@request
end

def http_request_parameters
@options
end
def http_request_parameters
@options
end
end
end
end
20 changes: 10 additions & 10 deletions lib/tankard/api/styles.rb
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ def initialize(request)
@request = request
end

private
private

def http_request_uri
'styles'
end
def http_request_uri
'styles'
end

def http_client
@request
end
def http_client
@request
end

def http_request_parameters
{}
end
def http_request_parameters
{}
end
end
end
end
20 changes: 10 additions & 10 deletions lib/tankard/api/utils/find.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ def find(id_or_array, options = {})
end
end

private
private

def route
fail NoMethodError, 'Must implement and return the base route'
end
def route
fail NoMethodError, 'Must implement and return the base route'
end

def http_client
fail NoMethodError, 'Must return the http object to make requests with'
end
def http_client
fail NoMethodError, 'Must return the http object to make requests with'
end

def http_request_parameters
fail NoMethodError, 'Must return a hash like structure with request parameters'
end
def http_request_parameters
fail NoMethodError, 'Must return a hash like structure with request parameters'
end
end
end
end
Expand Down

0 comments on commit a08b842

Please sign in to comment.