capsule_crm 1.6.1 → 1.6.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f4b9fd67a190082bdfaee77004d8b1a955292f6e
4
- data.tar.gz: 0194fb59ce8ae5227ecbdf97db8b69384ae810b1
3
+ metadata.gz: e63af1aeb254c386c75f71887655f99499fb4738
4
+ data.tar.gz: d686a04491edd661dc7595611fd78a2b906f4687
5
5
  SHA512:
6
- metadata.gz: db99f83850c54977fea4732871099fc1f1fc5e31f01c8cefda62eb83f29d2f17e09147322e3ddd6f5489ad0435e2659aee1c3ffca06688b973f4aca64bb10b97
7
- data.tar.gz: 316ac65226479c988cc5f0565ea9abbe5301a88b66c0f5e4d0c6dc22dccffd6daa97a85f8dcd63248623dda62c89b6d7239c6bd7400d44348f9a2897381afa4c
6
+ metadata.gz: 9738614f297ebd8b9d293c1a1e2be92f03d4ed254780497eaf89e38ee6832d8f3947b3c5dd203833f41a1fe99ade6f4f968b43f1e581ceada44f2aae97e8d82f
7
+ data.tar.gz: 78eb9bd924102eb42dfbae78262d51a5c28c45444465020e4cf8ef0396aab6c23fc3e99d9ef7381678b2069b4a489dc13452e90e6cfe54571ef117e1a736fafa
data/.hound.yml CHANGED
@@ -1,3 +1,739 @@
1
+ # These are all the cops that are enabled in the default configuration.
2
+
3
+ AccessModifierIndentation:
4
+ Description: Check indentation of private/protected visibility modifiers.
5
+ Enabled: false
6
+
7
+ AccessorMethodName:
8
+ Description: Check the naming of accessor methods for get_/set_.
9
+ Enabled: false
10
+
11
+ Alias:
12
+ Description: 'Use alias_method instead of alias.'
13
+ Enabled: false
14
+
15
+ AlignArray:
16
+ Description: >-
17
+ Align the elements of an array literal if they span more than
18
+ one line.
19
+ Enabled: false
20
+
21
+ AlignHash:
22
+ Description: >-
23
+ Align the elements of a hash literal if they span more than
24
+ one line.
25
+ Enabled: false
26
+
27
+ AlignParameters:
28
+ Description: >-
29
+ Align the parameters of a method call if they span more
30
+ than one line.
31
+ Enabled: false
32
+
33
+ AndOr:
34
+ Description: 'Use &&/|| instead of and/or.'
35
+ Enabled: true
36
+
37
+ ArrayJoin:
38
+ Description: 'Use Array#join instead of Array#*.'
39
+ Enabled: false
40
+
41
+ AsciiComments:
42
+ Description: 'Use only ascii symbols in comments.'
43
+ Enabled: false
44
+
45
+ AsciiIdentifiers:
46
+ Description: 'Use only ascii symbols in identifiers.'
47
+ Enabled: false
48
+
49
+ Attr:
50
+ Description: 'Checks for uses of Module#attr.'
51
+ Enabled: false
52
+
53
+ BeginBlock:
54
+ Description: 'Avoid the use of BEGIN blocks.'
55
+ Enabled: false
56
+
57
+ BlockComments:
58
+ Description: 'Do not use block comments.'
59
+ Enabled: true
60
+
61
+ BlockNesting:
62
+ Description: 'Avoid excessive block nesting'
63
+ Enabled: false
64
+
65
+ Blocks:
66
+ Description: >-
67
+ Avoid using {...} for multi-line blocks (multiline chaining is
68
+ always ugly).
69
+ Prefer {...} over do...end for single-line blocks.
70
+ Enabled: true
71
+
72
+ BracesAroundHashParameters:
73
+ # Valid values are: braces, no_braces
74
+ EnforcedStyle: no_braces
75
+ Enabled: true
76
+
77
+ CaseEquality:
78
+ Description: 'Avoid explicit use of the case equality operator(===).'
79
+ Enabled: false
80
+
81
+ CaseIndentation:
82
+ Description: 'Indentation of when in a case/when/[else/]end.'
83
+ Enabled: false
84
+
85
+ CharacterLiteral:
86
+ Description: 'Checks for uses of character literals.'
87
+ Enabled: false
88
+
89
+ ClassAndModuleCamelCase:
90
+ Description: 'Use CamelCase for classes and modules.'
91
+ Enabled: true
92
+
93
+ ClassAndModuleChildren:
94
+ Description: 'Checks style of children classes and modules.'
95
+ Enabled: false
96
+
97
+ ClassLength:
98
+ Description: 'Avoid classes longer than 100 lines of code.'
99
+ Enabled: false
100
+
101
+ ClassMethods:
102
+ Description: 'Use self when defining module/class methods.'
103
+ Enabled: true
104
+
105
+ ClassVars:
106
+ Description: 'Avoid the use of class variables.'
107
+ Enabled: false
108
+
109
+ CollectionMethods:
110
+ Description: 'Preferred collection methods.'
111
+ Enabled: false
112
+
113
+ ColonMethodCall:
114
+ Description: 'Do not use :: for method call.'
115
+ Enabled: true
116
+
117
+ CommentAnnotation:
118
+ Description: >-
119
+ Checks formatting of special comments
120
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
121
+ Enabled: false
122
+
123
+ ConstantName:
124
+ Description: 'Constants should use SCREAMING_SNAKE_CASE.'
125
+ Enabled: true
126
+
127
+ CyclomaticComplexity:
128
+ Description: 'Avoid complex methods.'
129
+ Enabled: false
130
+
131
+ DefWithParentheses:
132
+ Description: 'Use def with parentheses when there are arguments.'
133
+ Enabled: true
134
+
135
+ DefWithoutParentheses:
136
+ Description: >
137
+ Omit the parentheses when the method doesn't accept
138
+ any arguments.
139
+ Enabled: true
140
+
141
+ DeprecatedHashMethods:
142
+ Description: 'Checks for use of deprecated Hash methods.'
143
+ Enabled: false
144
+
145
+ Documentation:
146
+ Description: 'Document classes and non-namespace modules.'
147
+ Enabled: false
148
+
149
+ DotPosition:
150
+ Description: 'Checks the position of the dot in multi-line method calls.'
151
+ Style: 'leading'
152
+ Enabled: false
153
+
154
+ DoubleNegation:
155
+ Description: 'Checks for uses of double negation (!!).'
156
+ Enabled: false
157
+
158
+ EmptyLineBetweenDefs:
159
+ Description: 'Use empty lines between defs.'
160
+ Enabled: true
161
+
162
+ EmptyLines:
163
+ Description: "Don't use several empty lines in a row."
164
+ Enabled: true
165
+
166
+ EmptyLinesAroundAccessModifier:
167
+ Description: "Keep blank lines around access modifiers."
168
+ Enabled: false
169
+
170
+ EmptyLinesAroundBody:
171
+ Description: "Keeps track of empty lines around expression bodies."
172
+ Enabled: false
173
+
174
+ EmptyLiteral:
175
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
176
+ Enabled: false
177
+
178
+ Encoding:
179
+ Description: 'Use UTF-8 as the source file encoding.'
180
+ Enabled: false
181
+
182
+ EndBlock:
183
+ Description: 'Avoid the use of END blocks.'
184
+ Enabled: false
185
+
186
+ EndOfLine:
187
+ Description: 'Use Unix-style line endings.'
188
+ Enabled: true
189
+
190
+ EvenOdd:
191
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
192
+ Enabled: false
193
+
194
+ FileName:
195
+ Description: 'Use snake_case for source file names.'
196
+ Enabled: false
197
+
198
+ FinalNewline:
199
+ Description: 'Checks for a final newline in a source file.'
200
+ Enabled: true
201
+
202
+ FlipFlop:
203
+ Description: 'Checks for flip flops'
204
+ Enabled: false
205
+
206
+ For:
207
+ Description: 'Checks use of for or each in multiline loops.'
208
+ Enabled: false
209
+
210
+ FormatString:
211
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
212
+ Enabled: false
213
+
214
+ GlobalVars:
215
+ Description: 'Do not introduce global variables.'
216
+ Enabled: false
217
+
218
+ HashSyntax:
219
+ Description: >
220
+ Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax
221
+ { :a => 1, :b => 2 }.
222
+ EnforcedStyle: ruby19
223
+ Enabled: true
224
+
225
+ IfUnlessModifier:
226
+ Description: >-
227
+ Favor modifier if/unless usage when you have a
228
+ single-line body.
229
+ Enabled: false
230
+
231
+ IfWithSemicolon:
232
+ Description: 'Never use if x; .... Use the ternary operator instead.'
233
+ Enabled: true
234
+
235
+ IndentationConsistency:
236
+ Description: 'Keep indentation straight.'
237
+ Enabled: fals
238
+
239
+ IndentationWidth:
240
+ Description: 'Use 2 spaces for indentation.'
241
+ Enabled: true
242
+
243
+ IndentArray:
244
+ Description: >-
245
+ Checks the indentation of the first element in an array
246
+ literal.
247
+ Enabled: false
248
+
249
+ IndentHash:
250
+ Description: 'Checks the indentation of the first key in a hash literal.'
251
+ Enabled: false
252
+
253
+ Lambda:
254
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
255
+ Enabled: false
256
+
257
+ LambdaCall:
258
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
259
+ Enabled: false
260
+
261
+ LeadingCommentSpace:
262
+ Description: 'Comments should start with a space.'
263
+ Enabled: false
264
+
265
+ LineEndConcatenation:
266
+ Description: >-
267
+ Use \ instead of + or << to concatenate two string literals at
268
+ line end.
269
+ Enabled: false
270
+
271
+ LineLength:
272
+ Description: 'Limit lines to 80 characters.'
273
+ Max: 80
274
+ Enabled: true
275
+
276
+ MethodCallParentheses:
277
+ Description: 'Do not use parentheses for method calls with no arguments.'
278
+ Enabled: true
279
+
280
+ MethodDefParentheses:
281
+ Description: >-
282
+ Checks if the method definitions have or don't have
283
+ parentheses.
284
+ Enabled: false
285
+
286
+ MethodLength:
287
+ Description: 'Avoid methods longer than 10 lines of code.'
288
+ Enabled: false
289
+
290
+ MethodName:
291
+ # Valid values are: snake_case, camelCase
292
+ Description: 'Use the configured style when naming methods.'
293
+ EnforcedStyle: snake_case
294
+ Enabled: true
295
+
296
+ ModuleFunction:
297
+ Description: 'Checks for usage of `extend self` in modules.'
298
+ Enabled: false
299
+
300
+ MultilineBlockChain:
301
+ Description: 'Avoid multi-line chains of blocks.'
302
+ Enabled: false
303
+
304
+ MultilineIfThen:
305
+ Description: 'Never use then for multi-line if/unless.'
306
+ Enabled: false
307
+
308
+ MultilineTernaryOperator:
309
+ Description: >-
310
+ Avoid multi-line ?: (the ternary operator);
311
+ use if/unless instead.
312
+ Enabled: false
313
+
314
+ NegatedIf:
315
+ Description: >-
316
+ Favor unless over if for negative conditions
317
+ (or control flow or).
318
+ Enabled: false
319
+
320
+ NegatedWhile:
321
+ Description: 'Favor until over while for negative conditions.'
322
+ Enabled: false
323
+
324
+ NestedTernaryOperator:
325
+ Description: 'Use one expression per branch in a ternary operator.'
326
+ Enabled: false
327
+
328
+ NilComparison:
329
+ Description: 'Prefer x.nil? to x == nil.'
330
+ Enabled: false
331
+
332
+ NonNilCheck:
333
+ Description: 'Checks for redundant nil checks.'
334
+ Enabled: false
335
+
336
+ Not:
337
+ Description: 'Use ! instead of not.'
338
+ Enabled: true
339
+
340
+ NumericLiterals:
341
+ Description: >-
342
+ Add underscores to large numeric literals to improve their
343
+ readability.
344
+ Enabled: false
345
+
346
+ OneLineConditional:
347
+ Description: >-
348
+ Favor the ternary operator(?:) over
349
+ if/then/else/end constructs.
350
+ Enabled: false
351
+
352
+ OpMethod:
353
+ Description: 'When defining binary operators, name the argument other.'
354
+ Enabled: false
355
+
356
+ ParameterLists:
357
+ Description: 'Avoid parameter lists longer than three or four parameters.'
358
+ Enabled: false
359
+
360
+ ParenthesesAroundCondition:
361
+ Description: >
362
+ Don't use parentheses around the condition of an
363
+ if/unless/while.
364
+ Enabled: true
365
+
366
+ PercentLiteralDelimiters:
367
+ Description: 'Use `%`-literal delimiters consistently'
368
+ Enabled: false
369
+
370
+ PerlBackrefs:
371
+ Description: 'Avoid Perl-style regex back references.'
372
+ Enabled: false
373
+
374
+ PredicateName:
375
+ Description: 'Check the names of predicate methods.'
376
+ Enabled: false
377
+
378
+ Proc:
379
+ Description: 'Use proc instead of Proc.new.'
380
+ Enabled: false
381
+
382
+ RaiseArgs:
383
+ Description: 'Checks the arguments passed to raise/fail.'
384
+ Enabled: false
385
+
386
+ ReduceArguments:
387
+ Description: 'Name reduce arguments |a, e| (accumulator, element)'
388
+ Enabled: true
389
+
390
+ RedundantBegin:
391
+ Description: "Don't use begin blocks when they are not needed."
392
+ Enabled: true
393
+
394
+ RedundantException:
395
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
396
+ Enabled: false
397
+
398
+ RedundantReturn:
399
+ Description: "Don't use return where it's not required."
400
+ Enabled: true
401
+
402
+ RedundantSelf:
403
+ Description: "Don't use self where it's not needed."
404
+ Enabled: true
405
+
406
+ RegexpLiteral:
407
+ Description: >-
408
+ Use %r for regular expressions matching more than
409
+ `MaxSlashes` '/' characters.
410
+ Use %r only for regular expressions matching more than
411
+ `MaxSlashes` '/' character.
412
+ Enabled: false
413
+
414
+ RescueModifier:
415
+ Description: 'Avoid using rescue in its modifier form.'
416
+ Enabled: false
417
+
418
+ SelfAssignment:
419
+ Description: 'Checks for places where self-assignment shorthand should have been used.'
420
+ Enabled: false
421
+
422
+ Semicolon:
423
+ Description: "Don't use semicolons to terminate expressions."
424
+ Enabled: false
425
+
426
+ SignalException:
427
+ Description: 'Checks for proper usage of fail and raise.'
428
+ Enabled: false
429
+
430
+ SingleLineBlockParams:
431
+ Description: 'Enforces the names of some block params.'
432
+ Enabled: false
433
+
434
+ SingleLineMethods:
435
+ Description: 'Avoid single-line methods.'
436
+ Enabled: false
437
+
438
+ SingleSpaceBeforeFirstArg:
439
+ Description: >-
440
+ Checks that exactly one space is used between a method name
441
+ and the first argument for method calls without parentheses.
442
+ Enabled: false
443
+
444
+ SpaceAfterColon:
445
+ Description: 'Use spaces after colons.'
446
+ Enabled: true
447
+
448
+ SpaceAfterComma:
449
+ Description: 'Use spaces after commas.'
450
+ Enabled: true
451
+
452
+ SpaceAfterControlKeyword:
453
+ Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
454
+ Enabled: true
455
+
456
+ SpaceAfterMethodName:
457
+ Description: >
458
+ Never put a space between a method name and the opening
459
+ parenthesis.
460
+ Enabled: true
461
+
462
+ SpaceAfterNot:
463
+ Description: Tracks redundant space after the ! operator.
464
+ Enabled: true
465
+
466
+ SpaceAfterSemicolon:
467
+ Description: 'Use spaces after semicolons.'
468
+ Enabled: true
469
+
470
+ SpaceBeforeBlockBraces:
471
+ Description: >-
472
+ Checks that the left block brace has or doesn't have space
473
+ before it.
474
+ Enabled: false
475
+
476
+ SpaceInsideBlockBraces:
477
+ Description: >-
478
+ Checks that block braces have or don't have surrounding space.
479
+ For blocks taking parameters, checks that the left brace has
480
+ or doesn't have trailing space.
481
+ Enabled: false
482
+
483
+ SpaceAroundEqualsInParameterDefault:
484
+ Description: >
485
+ Use spaces around the = operator when assigning default
486
+ values in def params.
487
+ Enabled: true
488
+
489
+ SpaceAroundOperators:
490
+ Description: 'Use spaces around operators.'
491
+ Enabled: true
492
+
493
+ SpaceBeforeModifierKeyword:
494
+ Description: 'Put a space before the modifier keyword.'
495
+ Enabled: true
496
+
497
+ SpaceInsideBrackets:
498
+ Description: 'No spaces after [ or before ].'
499
+ Enabled: true
500
+
501
+ SpaceInsideHashLiteralBraces:
502
+ Description: "Use spaces inside hash literal braces - or don't."
503
+ # Valid values (for both parameters) are: space, no_space
504
+ EnforcedStyle: space
505
+ EnforcedStyleForEmptyBraces: no_space
506
+ Enabled: true
507
+
508
+ SpaceInsideParens:
509
+ Description: 'No spaces after ( or before ).'
510
+ Enabled: true
511
+
512
+ SpecialGlobalVars:
513
+ Description: 'Avoid Perl-style global variables.'
514
+ Enabled: false
515
+
1
516
  StringLiterals:
2
- EnforcedStyle: double_quotes
3
- Enabled: true
517
+ # Valid values (denoting the preferred quote delimiters) are:
518
+ # single_quotes, double_quotes
519
+ EnforcedStyle: single_quotes
520
+ Enabled: true
521
+
522
+ SymbolName:
523
+ Description: 'Symbol literals should use snake_case.'
524
+ Enabled: true
525
+
526
+ Tab:
527
+ Description: 'No hard tabs.'
528
+ Enabled: true
529
+
530
+ TrailingBlankLines:
531
+ Description: 'Checks for superflous trailing blank lines.'
532
+ Enabled: true
533
+
534
+ TrailingComma:
535
+ Description: 'Checks for trailing comma in parameter lists and literals.'
536
+ Enabled: false
537
+
538
+ TrailingWhitespace:
539
+ Description: 'Avoid trailing whitespace.'
540
+ Enabled: true
541
+
542
+ TrivialAccessors:
543
+ Description: 'Prefer attr_* methods to trivial readers/writers.'
544
+ Enabled: true
545
+
546
+ UnlessElse:
547
+ Description: >
548
+ Never use unless with else. Rewrite these with the positive
549
+ case first.
550
+ Enabled: true
551
+
552
+ VariableInterpolation:
553
+ Description: >-
554
+ Don't interpolate global, instance and class variables
555
+ directly in strings.
556
+ Enabled: true
557
+
558
+ VariableName:
559
+ Description: 'Use the configured style when naming variables.'
560
+ # Valid values are: snake_case, camelCase
561
+ EnforcedStyle: snake_case
562
+ Enabled: true
563
+
564
+ WhenThen:
565
+ Description: 'Use when x then ... for one-line cases.'
566
+ Enabled: false
567
+
568
+ WhileUntilDo:
569
+ Description: 'Checks for redundant do after while or until.'
570
+ Enabled: false
571
+
572
+ WhileUntilModifier:
573
+ Description: >-
574
+ Favor modifier while/until usage when you have a
575
+ single-line body.
576
+ Enabled: false
577
+
578
+ WordArray:
579
+ Description: 'Use %w or %W for arrays of words.'
580
+ Enabled: false
581
+
582
+ #################### Lint ################################
583
+ ### Warnings
584
+
585
+ AmbiguousOperator:
586
+ Description: >-
587
+ Checks for ambiguous operators in the first argument of a
588
+ method invocation without parentheses.
589
+ Enabled: false
590
+
591
+ AmbiguousRegexpLiteral:
592
+ Description: >-
593
+ Checks for ambiguous regexp literals in the first argument of
594
+ a method invocation without parenthesis.
595
+ Enabled: false
596
+
597
+ AssignmentInCondition:
598
+ Description: "Don't use assignment in conditions."
599
+ Enabled: false
600
+
601
+ BlockAlignment:
602
+ Description: 'Align block ends correctly.'
603
+ Enabled: false
604
+
605
+ ConditionPosition:
606
+ Description: 'Checks for condition placed in a confusing position relative to the keyword.'
607
+ Enabled: false
608
+
609
+ Debugger:
610
+ Description: 'Check for debugger calls.'
611
+ Enabled: false
612
+
613
+ DeprecatedClassMethods:
614
+ Description: 'Check for deprecated class method calls.'
615
+ Enabled: false
616
+
617
+ ElseLayout:
618
+ Description: 'Check for odd code arrangement in an else block.'
619
+ Enabled: false
620
+
621
+ EmptyEnsure:
622
+ Description: 'Checks for empty ensure block.'
623
+ Enabled: false
624
+
625
+ EmptyInterpolation:
626
+ Description: 'Checks for empty string interpolation.'
627
+ Enabled: false
628
+
629
+ EndAlignment:
630
+ Description: 'Align ends correctly.'
631
+ Enabled: false
632
+
633
+ EndInMethod:
634
+ Description: 'END blocks should not be placed inside method definitions.'
635
+ Enabled: false
636
+
637
+ EnsureReturn:
638
+ Description: 'Never use return in an ensure block.'
639
+ Enabled: false
640
+
641
+ Eval:
642
+ Description: 'The use of eval represents a serious security risk.'
643
+ Enabled: false
644
+
645
+ HandleExceptions:
646
+ Description: "Don't suppress exception."
647
+ Enabled: false
648
+
649
+ InvalidCharacterLiteral:
650
+ Description: >-
651
+ Checks for invalid character literals with a non-escaped
652
+ whitespace character.
653
+ Enabled: false
654
+
655
+ LiteralInCondition:
656
+ Description: 'Checks of literals used in conditions.'
657
+ Enabled: false
658
+
659
+ LiteralInInterpolation:
660
+ Description: 'Checks for literals used in interpolation.'
661
+ Enabled: false
662
+
663
+ Loop:
664
+ Description: >-
665
+ Use Kernel#loop with break rather than begin/end/until or
666
+ begin/end/while for post-loop tests.
667
+ Enabled: false
668
+
669
+ ParenthesesAsGroupedExpression:
670
+ Description: >-
671
+ Checks for method calls with a space before the opening
672
+ parenthesis.
673
+ Enabled: false
674
+
675
+ RequireParentheses:
676
+ Description: >-
677
+ Use parentheses in the method call to avoid confusion
678
+ about precedence.
679
+ Enabled: false
680
+
681
+ RescueException:
682
+ Description: 'Avoid rescuing the Exception class.'
683
+ Enabled: false
684
+
685
+ ShadowingOuterLocalVariable:
686
+ Description: >-
687
+ Do not use the same name as outer local variable
688
+ for block arguments or block local variables.
689
+ Enabled: false
690
+
691
+ SpaceBeforeFirstArg:
692
+ Description: >-
693
+ Put a space between a method name and the first argument
694
+ in a method call without parentheses.
695
+ Enabled: false
696
+
697
+ StringConversionInInterpolation:
698
+ Description: 'Checks for Object#to_s usage in string interpolation.'
699
+ Enabled: false
700
+
701
+ UnderscorePrefixedVariableName:
702
+ Description: 'Do not use prefix `_` for a variable that is used.'
703
+ Enabled: false
704
+
705
+ UnusedBlockArgument:
706
+ Description: 'Checks for unused block arguments.'
707
+ Enabled: false
708
+
709
+ UnusedMethodArgument:
710
+ Description: 'Checks for unused method arguments.'
711
+ Enabled: false
712
+
713
+ UnreachableCode:
714
+ Description: 'Unreachable code.'
715
+ Enabled: false
716
+
717
+ UselessAccessModifier:
718
+ Description: 'Checks for useless access modifiers.'
719
+ Enabled: false
720
+
721
+ UselessAssignment:
722
+ Description: 'Checks for useless assignment to a local variable.'
723
+ Enabled: false
724
+
725
+ UselessComparison:
726
+ Description: 'Checks for comparison of something with itself.'
727
+ Enabled: false
728
+
729
+ UselessElseWithoutRescue:
730
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
731
+ Enabled: false
732
+
733
+ UselessSetterCall:
734
+ Description: 'Checks for useless setter call to a local variable.'
735
+ Enabled: false
736
+
737
+ Void:
738
+ Description: 'Possible use of operator/literal/variable in void context.'
739
+ Enabled: false
data/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.6.2
4
+
5
+ - Fix bug where responses errors always had a blank body
6
+
7
+ ## 1.6.1
8
+
9
+ - Fix issue where if capsulecrm.com returned a blank error response the
10
+ ResponseError would raise an undefined method exception
11
+
3
12
  ## 1.6.0
4
13
 
5
14
  - ResponseError#to_s now return the response message from the server so errors
data/Guardfile CHANGED
@@ -3,7 +3,8 @@
3
3
 
4
4
  notification :tmux
5
5
 
6
- guard 'rspec', all_on_start: true, all_after_pass: true, failed_mode: :keep do
6
+ guard 'rspec', cmd: 'rspec', all_on_start: true, all_after_pass: true,
7
+ failed_mode: :keep do
7
8
  watch(%r{^spec/.+_spec\.rb$})
8
9
  watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
9
10
  watch('spec/spec_helper.rb') { "spec" }
data/README.md CHANGED
@@ -38,8 +38,12 @@ can make any requests to it. If you are using rails then you can put this into
38
38
  your config/initializers folder.
39
39
  ```ruby
40
40
  CapsuleCRM.configure do |config|
41
- config.api_token = 'API Token here'
42
- config.subdomain = 'your capsule crm company subdomain here'
41
+ config.api_token = 'API Token here'
42
+ config.subdomain = 'your capsule crm company subdomain here'
43
+
44
+ # Optional
45
+ config.logger = your_logger # default is Logger.new(STDOUT)
46
+ config.perform_logging = true # default is false
43
47
  end
44
48
  ```
45
49
 
@@ -15,6 +15,10 @@ module CapsuleCRM
15
15
  end
16
16
  end
17
17
 
18
+ def error_from_env(env)
19
+ class_for_error_code(env[:status]).new(env)
20
+ end
21
+
18
22
  def class_name_for_error_name(name)
19
23
  name.to_s.titleize.gsub(' ', '')
20
24
  end
@@ -2,10 +2,17 @@ module CapsuleCRM
2
2
  module Faraday
3
3
  module Middleware
4
4
  class RaiseError < ::Faraday::Response::Middleware
5
+ attr_writer :error_factory
6
+
5
7
  def on_complete(env)
6
8
  return if env[:status] < 400
7
- raise CapsuleCRM::Errors.class_for_error_code(env[:status]).
8
- new(env[:response])
9
+ raise error_factory.error_from_env(env)
10
+ end
11
+
12
+ private
13
+
14
+ def error_factory
15
+ @error_factory ||= CapsuleCRM::Errors
9
16
  end
10
17
  end
11
18
  end
@@ -1,3 +1,3 @@
1
1
  module CapsuleCrm
2
- VERSION = '1.6.1'
2
+ VERSION = '1.6.2'
3
3
  end
@@ -0,0 +1,41 @@
1
+ require 'spec_helper'
2
+
3
+ describe CapsuleCRM::Errors do
4
+ describe '.error_from_env' do
5
+ let(:env) { OpenStruct.new(body: { message: 'test' }.to_json) }
6
+
7
+ subject { described_class.error_from_env(env) }
8
+
9
+ context 'with a 400 response' do
10
+ before { env.status = 400 }
11
+
12
+ it 'should return a bad request error' do
13
+ expect(subject).to be_a(CapsuleCRM::Errors::BadRequest)
14
+ end
15
+ end
16
+
17
+ context 'with a 401 response' do
18
+ before { env.status = 401 }
19
+
20
+ it 'should return a not authorized error' do
21
+ expect(subject).to be_a(CapsuleCRM::Errors::NotAuthorized)
22
+ end
23
+ end
24
+
25
+ context 'with a 404 response' do
26
+ before { env.status = 404 }
27
+
28
+ it 'should return a not found error' do
29
+ expect(subject).to be_a(CapsuleCRM::Errors::NotFound)
30
+ end
31
+ end
32
+
33
+ context 'with a 500 response' do
34
+ before { env.status = 500 }
35
+
36
+ it 'should return a internal server error' do
37
+ expect(subject).to be_a(CapsuleCRM::Errors::InternalServerError)
38
+ end
39
+ end
40
+ end
41
+ end
@@ -0,0 +1,59 @@
1
+ require 'spec_helper'
2
+
3
+ describe CapsuleCRM::Faraday::Middleware::RaiseError do
4
+ describe '#on_complete' do
5
+ subject { described_class.new }
6
+
7
+ context 'when the response is a success' do
8
+ let(:response) { Hash[status: 200] }
9
+
10
+ it 'should return nothing' do
11
+ expect(subject.on_complete(response)).to eql(nil)
12
+ end
13
+ end
14
+
15
+ context 'when the response is a 400' do
16
+ let(:response) do
17
+ OpenStruct.new(status: 400, body: { message: 'test' }.to_json)
18
+ end
19
+
20
+ it 'should raise a bad request error' do
21
+ expect { subject.on_complete(response) }.
22
+ to raise_error(CapsuleCRM::Errors::BadRequest)
23
+ end
24
+ end
25
+
26
+ context 'when the response is a 401' do
27
+ let(:response) do
28
+ OpenStruct.new(status: 401, body: { message: 'test' }.to_json)
29
+ end
30
+
31
+ it 'should raise a not authorized error' do
32
+ expect { subject.on_complete(response) }.
33
+ to raise_error(CapsuleCRM::Errors::NotAuthorized)
34
+ end
35
+ end
36
+
37
+ context 'when the response is a 404' do
38
+ let(:response) do
39
+ OpenStruct.new(status: 404, body: { message: 'test' }.to_json)
40
+ end
41
+
42
+ it 'should raise a not found error' do
43
+ expect { subject.on_complete(response) }.
44
+ to raise_error(CapsuleCRM::Errors::NotFound)
45
+ end
46
+ end
47
+
48
+ context 'when the response is a 500' do
49
+ let(:response) do
50
+ OpenStruct.new(status: 500, body: { message: 'test' }.to_json)
51
+ end
52
+
53
+ it 'should raise an internal server error' do
54
+ expect { subject.on_complete(response) }.
55
+ to raise_error(CapsuleCRM::Errors::InternalServerError)
56
+ end
57
+ end
58
+ end
59
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capsule_crm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.1
4
+ version: 1.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Beedle
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-28 00:00:00.000000000 Z
11
+ date: 2014-09-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -334,6 +334,8 @@ files:
334
334
  - spec/lib/capsule_crm/custom_field_spec.rb
335
335
  - spec/lib/capsule_crm/email_spec.rb
336
336
  - spec/lib/capsule_crm/errors/response_error_spec.rb
337
+ - spec/lib/capsule_crm/errors_spec.rb
338
+ - spec/lib/capsule_crm/faraday/middleware/raise_error_spec.rb
337
339
  - spec/lib/capsule_crm/history_spec.rb
338
340
  - spec/lib/capsule_crm/milestone_spec.rb
339
341
  - spec/lib/capsule_crm/normalizer_spec.rb
@@ -443,6 +445,8 @@ test_files:
443
445
  - spec/lib/capsule_crm/custom_field_spec.rb
444
446
  - spec/lib/capsule_crm/email_spec.rb
445
447
  - spec/lib/capsule_crm/errors/response_error_spec.rb
448
+ - spec/lib/capsule_crm/errors_spec.rb
449
+ - spec/lib/capsule_crm/faraday/middleware/raise_error_spec.rb
446
450
  - spec/lib/capsule_crm/history_spec.rb
447
451
  - spec/lib/capsule_crm/milestone_spec.rb
448
452
  - spec/lib/capsule_crm/normalizer_spec.rb