Skip to content

Commit

Permalink
Merge pull request #40 from Skookum/issue-38
Browse files Browse the repository at this point in the history
Fix Issue #36: client.meta.users failing
  • Loading branch information
ruprict committed Feb 17, 2018
2 parents debad28 + 3017c7f commit 0986b25
Show file tree
Hide file tree
Showing 13 changed files with 405 additions and 24 deletions.
2 changes: 0 additions & 2 deletions .pronto.yml

This file was deleted.

6 changes: 4 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
inherit_from: .rubocop_todo.yml

# require: rubocop-rspec

Rails:
Enabled: false

Style/AlignHash:
Layout/AlignHash:
Enabled: true
EnforcedHashRocketStyle: table
EnforcedColonStyle: table
Expand Down Expand Up @@ -33,5 +35,5 @@ Style/StringLiterals:
Style/SymbolArray:
Enabled: true

RSpec/FilePath:
Rails/FilePath:
Enabled: false
305 changes: 305 additions & 0 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,305 @@
# This configuration was generated by
# `rubocop --auto-gen-config`
# on 2018-02-16 12:43:07 -0500 using RuboCop version 0.52.1.
# The point is for the user to remove these configuration records
# one by one as the offenses are removed from the code base.
# Note that changes in the inspected code, or installation of new
# versions of RuboCop, may require this file to be generated again.

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: Include, TreatCommentsAsGroupSeparators.
# Include: **/Gemfile, **/gems.rb
Bundler/OrderedGems:
Exclude:
- 'Gemfile'

# Offense count: 1
# Configuration parameters: Include.
# Include: **/*.gemspec
Gemspec/RequiredRubyVersion:
Exclude:
- 'bamboozled.gemspec'

# Offense count: 17
# Cop supports --auto-correct.
# Configuration parameters: EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
# SupportedHashRocketStyles: key, separator, table
# SupportedColonStyles: key, separator, table
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
Layout/AlignHash:
Exclude:
- 'lib/bamboozled/api/base.rb'
- 'spec/lib/bamboozled/api/time_tracking_spec.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: leading, trailing
Layout/DotPosition:
Exclude:
- 'spec/lib/bamboozled/api/base_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLineAfterMagicComment:
Exclude:
- 'bamboozled.gemspec'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLinesAroundAccessModifier:
Exclude:
- 'lib/bamboozled/api/base.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, no_empty_lines
Layout/EmptyLinesAroundBlockBody:
Exclude:
- 'Gemfile'

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines
Layout/EmptyLinesAroundClassBody:
Exclude:
- 'lib/bamboozled/api/employee.rb'
- 'lib/bamboozled/api/meta.rb'
- 'lib/bamboozled/api/report.rb'

# Offense count: 1
# Cop supports --auto-correct.
Layout/EmptyLinesAroundMethodBody:
Exclude:
- 'examples/employees_over_time.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: IndentationWidth.
# SupportedStyles: special_inside_parentheses, consistent, align_braces
Layout/IndentHash:
EnforcedStyle: consistent

# Offense count: 3
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: normal, rails
Layout/IndentationConsistency:
Exclude:
- 'lib/bamboozled/api/base.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: symmetrical, new_line, same_line
Layout/MultilineMethodCallBraceLayout:
Exclude:
- 'lib/bamboozled/api/meta.rb'

# Offense count: 2
# Cop supports --auto-correct.
Layout/SpaceAfterColon:
Exclude:
- 'examples/employees_over_time.rb'

# Offense count: 2
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceBeforeBlockBraces:
Exclude:
- 'examples/employees_over_time.rb'
- 'lib/bamboozled/api/employee.rb'

# Offense count: 6
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SpaceBeforeBlockParameters.
# SupportedStyles: space, no_space
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideBlockBraces:
Exclude:
- 'examples/employees_over_time.rb'
- 'lib/bamboozled/api/employee.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces.
# SupportedStyles: space, no_space, compact
# SupportedStylesForEmptyBraces: space, no_space
Layout/SpaceInsideHashLiteralBraces:
Exclude:
- 'lib/bamboozled/api/employee.rb'
- 'spec/lib/bamboozled/base_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
Exclude:
- 'lib/bamboozled/api/employee.rb'

# Offense count: 1
Lint/UselessAssignment:
Exclude:
- 'spec/lib/bamboozled_spec.rb'

# Offense count: 3
Metrics/AbcSize:
Max: 43

# Offense count: 6
# Configuration parameters: CountComments, ExcludedMethods.
Metrics/BlockLength:
Max: 104

# Offense count: 1
Metrics/CyclomaticComplexity:
Max: 15

# Offense count: 2
# Configuration parameters: CountComments.
Metrics/MethodLength:
Max: 54

# Offense count: 1
Metrics/PerceivedComplexity:
Max: 8

# Offense count: 8
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: braces, no_braces, context_dependent
Style/BracesAroundHashParameters:
Exclude:
- 'lib/bamboozled/api/base.rb'
- 'spec/lib/bamboozled/api/base_spec.rb'
- 'spec/lib/bamboozled/base_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/EmptyLiteral:
Exclude:
- 'lib/bamboozled/api/employee.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/Encoding:
Exclude:
- 'bamboozled.gemspec'

# Offense count: 23
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: when_needed, always, never
Style/FrozenStringLiteralComment:
Enabled: false

# Offense count: 1
# Cop supports --auto-correct.
Style/IfUnlessModifier:
Exclude:
- 'lib/bamboozled/api/time_off.rb'

# Offense count: 6
Style/MethodCalledOnDoEndBlock:
Exclude:
- 'examples/employees_over_time.rb'
- 'spec/lib/bamboozled/api/time_tracking_spec.rb'

# Offense count: 1
Style/MultilineBlockChain:
Exclude:
- 'examples/employees_over_time.rb'

# Offense count: 2
# Configuration parameters: SuspiciousParamNames.
# SuspiciousParamNames: options, opts, args, params, parameters
Style/OptionHash:
Exclude:
- 'lib/bamboozled/api/base.rb'
- 'lib/bamboozled/api/time_off.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: PreferredDelimiters.
Style/PercentLiteralDelimiters:
Exclude:
- 'examples/employees_over_time.rb'
- 'lib/bamboozled/api/employee.rb'
- 'spec/lib/bamboozled/api/employee_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/PerlBackrefs:
Exclude:
- 'lib/bamboozled/api/employee.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowInnerSlashes.
# SupportedStyles: slashes, percent_r, mixed
Style/RegexpLiteral:
Exclude:
- 'Guardfile'

# Offense count: 3
# Cop supports --auto-correct.
Style/RescueModifier:
Exclude:
- 'examples/employees_over_time.rb'
- 'lib/bamboozled/api/employee.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle.
# SupportedStyles: implicit, explicit
Style/RescueStandardError:
Exclude:
- 'lib/bamboozled/api/base.rb'

# Offense count: 88
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
# SupportedStyles: single_quotes, double_quotes
Style/StringLiterals:
Exclude:
- 'examples/employees_over_time.rb'
- 'lib/bamboozled/api/base.rb'
- 'lib/bamboozled/api/employee.rb'
- 'lib/bamboozled/api/report.rb'
- 'lib/bamboozled/api/time_tracking.rb'
- 'spec/lib/bamboozled/api/time_tracking_spec.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: .
# SupportedStyles: percent, brackets
Style/SymbolArray:
EnforcedStyle: percent
MinSize: 6

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
Style/TernaryParentheses:
Exclude:
- 'examples/employees_over_time.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: WordRegex.
# SupportedStyles: percent, brackets
Style/WordArray:
EnforcedStyle: percent
MinSize: 3

# Offense count: 58
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
# URISchemes: http, https
Metrics/LineLength:
Max: 757
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
language: ruby
sudo: false
rvm:
- 2.0.0
- 2.1
- 2.2
- 2.3.0
- 2.4.0
- ruby-head
- jruby-head

Expand All @@ -14,7 +13,7 @@ install:

script:
- bundle exec rspec
- PULL_REQUEST_ID=${TRAVIS_PULL_REQUEST} bundle exec pronto run -f github_status github_pr -c origin/master
- bundle exec rubocop

matrix:
fast_finish: true
Expand Down
5 changes: 0 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,4 @@ group :development, :test do
gem "rubocop", require: false
gem "rubocop-rspec", require: false

gem "pronto"
gem "pronto-rubocop", require: false
gem "pronto-flay", require: false
gem "pronto-reek", require: false
gem "pronto-brakeman", require: false
end
5 changes: 4 additions & 1 deletion lib/bamboozled/api/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ def request(method, path, options = {})
JSON.parse(response)
end
rescue
MultiXml.parse(response, symbolize_keys: true)
typecast = options.fetch(:typecast_values, true)
MultiXml.parse(response,
symbolize_keys: true,
typecast_xml_value: typecast)
end
when 400
raise Bamboozled::BadRequest.new(response, params, 'The request was invalid or could not be understood by the server. Resubmitting the request will likely result in the same error.')
Expand Down
20 changes: 15 additions & 5 deletions lib/bamboozled/api/meta.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,22 @@
module Bamboozled
module API
class Meta < Base
def users
request(:get, "meta/users").values
end

def fields
request(:get, "meta/fields")
end

def lists
request(:get, "meta/lists")
end

[:field, :table, :list, :user].each do |action|
define_method("#{action}s") do
result = request(:get, "meta/#{action}s")
result["#{action}s".to_sym][action]
end
def tables
request(
:get, "meta/tables",
typecast_values: false)[:tables]
end

end
Expand Down

0 comments on commit 0986b25

Please sign in to comment.