excon-rails 0.1.0 → 0.1.1

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: 48b2039b185df915eed299bd0f926910ff7c0ca7
4
- data.tar.gz: d8a9c2fb80a6530de30a13f5e99e83501424c4da
3
+ metadata.gz: 48100756bf5831c584d8203b3e006ebe1d0e8bb3
4
+ data.tar.gz: fcc88d97fe4dffbd7dfcb354b9af4f0e26a9f625
5
5
  SHA512:
6
- metadata.gz: ed778ec90ae6c9d5c6036e5267d4642c1771f59c0fe78b827444229bc628b3316e8902320421683d6de233397833e2d63ba8d42d80a9956fe247a5306f8e9d74
7
- data.tar.gz: acfe782ebac451de2727f0cef718c3039de64186cc6ee2cfdeefcf2d689a98e4bf930e1cb3b4c5b2615f2e75eb69ed4f05750eeb47b362db85eeaae31961eee5
6
+ metadata.gz: cb0269eb7415757e7e1158d9717f4761e37f09ad0d3ca75cd803e69fd116c24065f5b79bbaadaba49b1808b73f1bd64501e3fd94fdb758bf0d67fac740edb2b9
7
+ data.tar.gz: 14ba867831abb418a57ad998a496df61d2852a97c4b50f8daf4c3473f30d95493e16c238585cd6660534e41c0dbc99a8985407d1337280ac41db1dd1fe7169f0
data/.rubocop.yml ADDED
@@ -0,0 +1,685 @@
1
+ AllCops:
2
+ StyleGuideCopsOnly: false
3
+ Include:
4
+ - "**/*.gemspec"
5
+ - "**/*.podspec"
6
+ - "**/*.jbuilder"
7
+ - "**/*.rake"
8
+ - "**/*.opal"
9
+ - "**/Gemfile"
10
+ - "**/Rakefile"
11
+ - "**/Capfile"
12
+ - "**/Guardfile"
13
+ - "**/Podfile"
14
+ - "**/Thorfile"
15
+ - "**/Vagrantfile"
16
+ - "**/Berksfile"
17
+ - "**/Cheffile"
18
+ - "**/Vagabondfile"
19
+ Exclude:
20
+ - excon-rails.gemspec
21
+ - lib/excon/rails/version.rb
22
+ - "vendor/**/*"
23
+ - "gemfiles/vendor/**/*"
24
+
25
+ Lint/HandleExceptions:
26
+ Exclude:
27
+ - 'spec/**/*'
28
+
29
+ Style/Documentation:
30
+ Exclude:
31
+ - 'spec/**/*'
32
+
33
+ Style/Documentation:
34
+ Enabled: false
35
+
36
+ Style/ConstantName:
37
+ Enabled: false
38
+
39
+ Style/FileName:
40
+ Exclude:
41
+ - 'lib/excon-rails.rb'
42
+
43
+ Style/LineLength:
44
+ Exclude:
45
+ - 'excon-rails.gemspec'
46
+
47
+
48
+ Style/AccessModifierIndentation:
49
+ Enabled: true
50
+ EnforcedStyle: indent
51
+ SupportedStyles:
52
+ - outdent
53
+ - indent
54
+ Style/AlignHash:
55
+ Enabled: true
56
+ EnforcedHashRocketStyle: key
57
+ EnforcedColonStyle: key
58
+ EnforcedLastArgumentHashStyle: always_inspect
59
+ SupportedLastArgumentHashStyles:
60
+ - always_inspect
61
+ - always_ignore
62
+ - ignore_implicit
63
+ - ignore_explicit
64
+ Style/AlignParameters:
65
+ Enabled: true
66
+ EnforcedStyle: with_first_parameter
67
+ SupportedStyles:
68
+ - with_first_parameter
69
+ - with_fixed_indentation
70
+ Style/AndOr:
71
+ Enabled: true
72
+ EnforcedStyle: always
73
+ SupportedStyles:
74
+ - always
75
+ - conditionals
76
+ Style/BarePercentLiterals:
77
+ Enabled: true
78
+ EnforcedStyle: bare_percent
79
+ SupportedStyles:
80
+ - percent_q
81
+ - bare_percent
82
+ Style/BracesAroundHashParameters:
83
+ Enabled: true
84
+ EnforcedStyle: no_braces
85
+ SupportedStyles:
86
+ - braces
87
+ - no_braces
88
+ - context_dependent
89
+ Style/CaseIndentation:
90
+ Enabled: true
91
+ IndentWhenRelativeTo: case
92
+ SupportedStyles:
93
+ - case
94
+ - end
95
+ IndentOneStep: false
96
+ Style/ClassAndModuleChildren:
97
+ Enabled: false
98
+ EnforcedStyle: nested
99
+ SupportedStyles:
100
+ - nested
101
+ - compact
102
+ Style/ClassCheck:
103
+ Enabled: true
104
+ EnforcedStyle: is_a?
105
+ SupportedStyles:
106
+ - is_a?
107
+ - kind_of?
108
+ Style/CollectionMethods:
109
+ Enabled: true
110
+ PreferredMethods:
111
+ collect: map
112
+ collect!: map!
113
+ find: detect
114
+ find_all: select
115
+ reduce: inject
116
+ Style/CommentAnnotation:
117
+ Description: Checks formatting of special comments (TODO, FIXME, OPTIMIZE, HACK,
118
+ REVIEW).
119
+ Enabled: false
120
+ Keywords:
121
+ - TODO
122
+ - FIXME
123
+ - OPTIMIZE
124
+ - HACK
125
+ - REVIEW
126
+ Style/DotPosition:
127
+ Enabled: true
128
+ EnforcedStyle: leading
129
+ Style/EmptyLineBetweenDefs:
130
+ Enabled: true
131
+ AllowAdjacentOneLineDefs: false
132
+ Style/EmptyLinesAroundBlockBody:
133
+ Enabled: true
134
+ EnforcedStyle: no_empty_lines
135
+ SupportedStyles:
136
+ - empty_lines
137
+ - no_empty_lines
138
+ Style/EmptyLinesAroundClassBody:
139
+ Enabled: true
140
+ EnforcedStyle: no_empty_lines
141
+ SupportedStyles:
142
+ - empty_lines
143
+ - no_empty_lines
144
+ Style/EmptyLinesAroundModuleBody:
145
+ Enabled: true
146
+ EnforcedStyle: no_empty_lines
147
+ SupportedStyles:
148
+ - empty_lines
149
+ - no_empty_lines
150
+ Style/Encoding:
151
+ Enabled: false
152
+ EnforcedStyle: always
153
+ SupportedStyles:
154
+ - when_needed
155
+ - always
156
+ Style/FileName:
157
+ Enabled: false
158
+ Exclude: []
159
+ Style/FirstParameterIndentation:
160
+ Enabled: true
161
+ EnforcedStyle: special_for_inner_method_call_in_parentheses
162
+ SupportedStyles:
163
+ - consistent
164
+ - special_for_inner_method_call
165
+ - special_for_inner_method_call_in_parentheses
166
+ Style/For:
167
+ Enabled: true
168
+ EnforcedStyle: each
169
+ SupportedStyles:
170
+ - for
171
+ - each
172
+ Style/FormatString:
173
+ Enabled: false
174
+ EnforcedStyle: format
175
+ SupportedStyles:
176
+ - format
177
+ - sprintf
178
+ - percent
179
+ Style/GlobalVars:
180
+ Enabled: false
181
+ AllowedVariables: []
182
+ Style/GuardClause:
183
+ Description: Check for conditionals that can be replaced with guard clauses
184
+ Enabled: false
185
+ MinBodyLength: 1
186
+ Style/HashSyntax:
187
+ Enabled: true
188
+ EnforcedStyle: ruby19
189
+ SupportedStyles:
190
+ - ruby19
191
+ - hash_rockets
192
+ Style/IfUnlessModifier:
193
+ Enabled: false
194
+ MaxLineLength: 80
195
+ Style/IndentationWidth:
196
+ Enabled: true
197
+ Width: 2
198
+ Style/IndentHash:
199
+ Enabled: true
200
+ EnforcedStyle: special_inside_parentheses
201
+ SupportedStyles:
202
+ - special_inside_parentheses
203
+ - consistent
204
+ Style/LambdaCall:
205
+ Enabled: false
206
+ EnforcedStyle: call
207
+ SupportedStyles:
208
+ - call
209
+ - braces
210
+ Style/Next:
211
+ Enabled: false
212
+ EnforcedStyle: skip_modifier_ifs
213
+ MinBodyLength: 3
214
+ SupportedStyles:
215
+ - skip_modifier_ifs
216
+ - always
217
+ Style/NonNilCheck:
218
+ Enabled: true
219
+ IncludeSemanticChanges: false
220
+ Style/MethodDefParentheses:
221
+ Enabled: true
222
+ EnforcedStyle: require_parentheses
223
+ SupportedStyles:
224
+ - require_parentheses
225
+ - require_no_parentheses
226
+ Style/MethodName:
227
+ Enabled: true
228
+ EnforcedStyle: snake_case
229
+ SupportedStyles:
230
+ - snake_case
231
+ - camelCase
232
+ Style/MultilineOperationIndentation:
233
+ Enabled: true
234
+ EnforcedStyle: indented
235
+ Style/NumericLiterals:
236
+ Enabled: false
237
+ MinDigits: 5
238
+ Style/ParenthesesAroundCondition:
239
+ Enabled: true
240
+ AllowSafeAssignment: true
241
+ Style/PercentLiteralDelimiters:
242
+ Description: Use `%`-literal delimiters consistently
243
+ Enabled: false
244
+ PreferredDelimiters:
245
+ "%": "()"
246
+ "%i": "()"
247
+ "%q": "()"
248
+ "%Q": "()"
249
+ "%r": "{}"
250
+ "%s": "()"
251
+ "%w": "()"
252
+ "%W": "()"
253
+ "%x": "()"
254
+ Style/PercentQLiterals:
255
+ Enabled: true
256
+ EnforcedStyle: lower_case_q
257
+ SupportedStyles:
258
+ - lower_case_q
259
+ - upper_case_q
260
+ Style/PredicateName:
261
+ Enabled: true
262
+ NamePrefix:
263
+ - is_
264
+ - has_
265
+ - have_
266
+ NamePrefixBlacklist:
267
+ - is_
268
+ Style/RaiseArgs:
269
+ Enabled: false
270
+ EnforcedStyle: exploded
271
+ SupportedStyles:
272
+ - compact
273
+ - exploded
274
+ Style/RedundantReturn:
275
+ Enabled: true
276
+ AllowMultipleReturnValues: false
277
+ Style/RegexpLiteral:
278
+ Description: Use %r for regular expressions matching more than `MaxSlashes` '/'
279
+ characters. Use %r only for regular expressions matching more than `MaxSlashes`
280
+ '/' character.
281
+ Enabled: false
282
+ MaxSlashes: 1
283
+
284
+ Style/Semicolon:
285
+ Enabled: true
286
+ AllowAsExpressionSeparator: false
287
+
288
+ Style/SignalException:
289
+ Enabled: false
290
+
291
+ Style/SingleLineBlockParams:
292
+ Enabled: false
293
+
294
+ Style/SingleLineMethods:
295
+ Enabled: false
296
+
297
+ Style/StringLiterals:
298
+ Enabled: true
299
+ EnforcedStyle: single_quotes
300
+
301
+ Style/StringLiteralsInInterpolation:
302
+ Enabled: true
303
+ EnforcedStyle: single_quotes
304
+
305
+ Style/SpaceAroundBlockParameters:
306
+ Enabled: true
307
+ EnforcedStyleInsidePipes: no_space
308
+
309
+ Style/SpaceAroundEqualsInParameterDefault:
310
+ Enabled: true
311
+ EnforcedStyle: space
312
+
313
+ Style/SpaceBeforeBlockBraces:
314
+ Enabled: true
315
+ EnforcedStyle: space
316
+ SupportedStyles:
317
+ - space
318
+ - no_space
319
+ Style/SpaceInsideBlockBraces:
320
+ Enabled: true
321
+ EnforcedStyle: space
322
+ SupportedStyles:
323
+ - space
324
+ - no_space
325
+ EnforcedStyleForEmptyBraces: no_space
326
+ SpaceBeforeBlockParameters: true
327
+ Style/SpaceInsideHashLiteralBraces:
328
+ Enabled: true
329
+ EnforcedStyle: space
330
+ EnforcedStyleForEmptyBraces: no_space
331
+ SupportedStyles:
332
+ - space
333
+ - no_space
334
+ Style/SymbolProc:
335
+ Enabled: true
336
+ IgnoredMethods:
337
+ - respond_to
338
+ Style/TrailingBlankLines:
339
+ Enabled: true
340
+ EnforcedStyle: final_newline
341
+ SupportedStyles:
342
+ - final_newline
343
+ - final_blank_line
344
+ Style/TrailingComma:
345
+ Enabled: false
346
+ EnforcedStyleForMultiline: no_comma
347
+ SupportedStyles:
348
+ - comma
349
+ - no_comma
350
+ Style/TrivialAccessors:
351
+ Enabled: false
352
+ ExactNameMatch: false
353
+ AllowPredicates: false
354
+ AllowDSLWriters: false
355
+ Whitelist:
356
+ - to_ary
357
+ - to_a
358
+ - to_c
359
+ - to_enum
360
+ - to_h
361
+ - to_hash
362
+ - to_i
363
+ - to_int
364
+ - to_io
365
+ - to_open
366
+ - to_path
367
+ - to_proc
368
+ - to_r
369
+ - to_regexp
370
+ - to_str
371
+ - to_s
372
+ - to_sym
373
+ Style/VariableName:
374
+ Enabled: true
375
+ EnforcedStyle: snake_case
376
+ SupportedStyles:
377
+ - snake_case
378
+ - camelCase
379
+ Style/WhileUntilModifier:
380
+ Enabled: false
381
+ MaxLineLength: 80
382
+ Style/WordArray:
383
+ Enabled: false
384
+ Metrics/AbcSize:
385
+ Enabled: true
386
+ Max: 15
387
+ Metrics/BlockNesting:
388
+ Enabled: true
389
+ Max: 3
390
+ Metrics/ClassLength:
391
+ Enabled: false
392
+ CountComments: false
393
+ Max: 100
394
+ Metrics/CyclomaticComplexity:
395
+ Enabled: true
396
+ Max: 6
397
+ Metrics/LineLength:
398
+ Enabled: true
399
+ Max: 80
400
+ AllowURI: true
401
+ URISchemes:
402
+ - http
403
+ - https
404
+ Metrics/MethodLength:
405
+ Enabled: false
406
+ CountComments: false
407
+ Max: 10
408
+ Metrics/ParameterLists:
409
+ Enabled: false
410
+ Max: 5
411
+ CountKeywordArgs: true
412
+ Metrics/PerceivedComplexity:
413
+ Description: A complexity metric geared towards measuring complexity for a human
414
+ reader.
415
+ Enabled: false
416
+ Max: 7
417
+ Lint/AssignmentInCondition:
418
+ Enabled: false
419
+ AllowSafeAssignment: true
420
+ Lint/EndAlignment:
421
+ Enabled: true
422
+ AlignWith: keyword
423
+ SupportedStyles:
424
+ - keyword
425
+ - variable
426
+ Lint/DefEndAlignment:
427
+ Enabled: true
428
+ AlignWith: start_of_line
429
+ SupportedStyles:
430
+ - start_of_line
431
+ - def
432
+ Style/InlineComment:
433
+ Enabled: false
434
+ Style/MethodCalledOnDoEndBlock:
435
+ Enabled: false
436
+ Style/SymbolArray:
437
+ Enabled: false
438
+ Style/ExtraSpacing:
439
+ Enabled: true
440
+ Style/AccessorMethodName:
441
+ Enabled: false
442
+ Style/Alias:
443
+ Enabled: false
444
+ Style/AlignArray:
445
+ Enabled: true
446
+ Style/ArrayJoin:
447
+ Enabled: false
448
+ Style/AsciiComments:
449
+ Enabled: false
450
+ Style/AsciiIdentifiers:
451
+ Enabled: false
452
+ Style/Attr:
453
+ Enabled: false
454
+ Style/BeginBlock:
455
+ Enabled: true
456
+ Style/BlockComments:
457
+ Enabled: true
458
+ Style/BlockEndNewline:
459
+ Enabled: true
460
+ Style/Blocks:
461
+ Enabled: true
462
+ Style/CaseEquality:
463
+ Enabled: false
464
+ Style/CharacterLiteral:
465
+ Enabled: false
466
+ Style/ClassAndModuleCamelCase:
467
+ Enabled: true
468
+ Style/ClassMethods:
469
+ Enabled: true
470
+ Style/ClassVars:
471
+ Enabled: false
472
+ Style/ColonMethodCall:
473
+ Enabled: false
474
+ Style/CommentIndentation:
475
+ Enabled: true
476
+ Style/ConstantName:
477
+ Enabled: false
478
+ Style/DefWithParentheses:
479
+ Enabled: true
480
+ Style/DeprecatedHashMethods:
481
+ Enabled: false
482
+ Style/Documentation:
483
+ Enabled: false
484
+ Style/DoubleNegation:
485
+ Enabled: false
486
+ Style/EachWithObject:
487
+ Enabled: false
488
+ Style/ElseAlignment:
489
+ Enabled: true
490
+ Style/EmptyElse:
491
+ Enabled: true
492
+ Style/EmptyLines:
493
+ Enabled: true
494
+ Style/EmptyLinesAroundAccessModifier:
495
+ Enabled: true
496
+ Style/EmptyLinesAroundMethodBody:
497
+ Enabled: true
498
+ Style/EmptyLiteral:
499
+ Enabled: false
500
+ Style/EndBlock:
501
+ Enabled: true
502
+ Style/EndOfLine:
503
+ Enabled: true
504
+ Style/EvenOdd:
505
+ Description: Favor the use of Fixnum#even? && Fixnum#odd?
506
+ Enabled: false
507
+ Style/FlipFlop:
508
+ Description: Checks for flip flops
509
+ Enabled: false
510
+ Style/IfWithSemicolon:
511
+ Enabled: false
512
+ Style/IndentationConsistency:
513
+ Enabled: true
514
+ Style/IndentArray:
515
+ Enabled: true
516
+ Style/InfiniteLoop:
517
+ Enabled: true
518
+ Style/Lambda:
519
+ Enabled: false
520
+ Style/LeadingCommentSpace:
521
+ Enabled: true
522
+ Style/LineEndConcatenation:
523
+ Enabled: false
524
+ Style/MethodCallParentheses:
525
+ Enabled: true
526
+ Style/ModuleFunction:
527
+ Enabled: false
528
+ Style/MultilineBlockChain:
529
+ Enabled: true
530
+ Style/MultilineBlockLayout:
531
+ Enabled: true
532
+ Style/MultilineIfThen:
533
+ Enabled: true
534
+ Style/MultilineTernaryOperator:
535
+ Enabled: true
536
+ Style/NegatedIf:
537
+ Enabled: false
538
+ Style/NegatedWhile:
539
+ Enabled: false
540
+ Style/NestedTernaryOperator:
541
+ Enabled: true
542
+ Style/NilComparison:
543
+ Enabled: false
544
+ Style/Not:
545
+ Enabled: false
546
+ Style/OneLineConditional:
547
+ Enabled: false
548
+ Style/OpMethod:
549
+ Enabled: false
550
+ Style/PerlBackrefs:
551
+ Enabled: false
552
+ Style/Proc:
553
+ Enabled: false
554
+ Style/RedundantBegin:
555
+ Enabled: true
556
+ Style/RedundantException:
557
+ Enabled: true
558
+ Style/RedundantSelf:
559
+ Enabled: true
560
+ Style/RescueModifier:
561
+ Enabled: true
562
+ Style/SelfAssignment:
563
+ Enabled: false
564
+ Style/SingleSpaceBeforeFirstArg:
565
+ Enabled: true
566
+ Style/SpaceAfterColon:
567
+ Enabled: true
568
+ Style/SpaceAfterComma:
569
+ Enabled: true
570
+ Style/SpaceAfterControlKeyword:
571
+ Enabled: true
572
+ Style/SpaceAfterMethodName:
573
+ Enabled: true
574
+ Style/SpaceAfterNot:
575
+ Enabled: true
576
+ Style/SpaceAfterSemicolon:
577
+ Enabled: true
578
+ Style/SpaceBeforeComma:
579
+ Enabled: true
580
+ Style/SpaceBeforeComment:
581
+ Enabled: true
582
+ Style/SpaceBeforeSemicolon:
583
+ Enabled: true
584
+ Style/SpaceAroundOperators:
585
+ Enabled: true
586
+ Style/SpaceBeforeModifierKeyword:
587
+ Enabled: true
588
+ Style/SpaceInsideBrackets:
589
+ Enabled: true
590
+ Style/SpaceInsideParens:
591
+ Enabled: true
592
+ Style/SpaceInsideRangeLiteral:
593
+ Enabled: true
594
+ Style/SpecialGlobalVars:
595
+ Enabled: false
596
+ Style/StructInheritance:
597
+ Enabled: true
598
+ Style/Tab:
599
+ Enabled: true
600
+ Style/TrailingWhitespace:
601
+ Enabled: true
602
+ Style/UnlessElse:
603
+ Enabled: true
604
+ Style/UnneededCapitalW:
605
+ Enabled: true
606
+ Style/UnneededPercentQ:
607
+ Enabled: true
608
+ Style/UnneededPercentX:
609
+ Enabled: true
610
+ Style/VariableInterpolation:
611
+ Enabled: false
612
+ Style/WhenThen:
613
+ Enabled: false
614
+ Style/WhileUntilDo:
615
+ Enabled: true
616
+ Lint/AmbiguousOperator:
617
+ Enabled: false
618
+ Lint/AmbiguousRegexpLiteral:
619
+ Enabled: false
620
+ Lint/BlockAlignment:
621
+ Enabled: true
622
+ Lint/ConditionPosition:
623
+ Enabled: false
624
+ Lint/Debugger:
625
+ Enabled: true
626
+ Lint/DeprecatedClassMethods:
627
+ Enabled: false
628
+ Lint/DuplicateMethods:
629
+ Enabled: true
630
+ Lint/ElseLayout:
631
+ Enabled: false
632
+ Lint/EmptyEnsure:
633
+ Enabled: true
634
+ Lint/EmptyInterpolation:
635
+ Enabled: true
636
+ Lint/EndInMethod:
637
+ Enabled: true
638
+ Lint/EnsureReturn:
639
+ Enabled: true
640
+ Lint/Eval:
641
+ Enabled: true
642
+ Lint/HandleExceptions:
643
+ Enabled: false
644
+ Lint/InvalidCharacterLiteral:
645
+ Enabled: false
646
+ Lint/LiteralInCondition:
647
+ Enabled: false
648
+ Lint/LiteralInInterpolation:
649
+ Enabled: false
650
+ Lint/Loop:
651
+ Enabled: false
652
+ Lint/ParenthesesAsGroupedExpression:
653
+ Enabled: false
654
+ Lint/RequireParentheses:
655
+ Enabled: false
656
+ Lint/RescueException:
657
+ Enabled: true
658
+ Lint/ShadowingOuterLocalVariable:
659
+ Enabled: true
660
+ Lint/SpaceBeforeFirstArg:
661
+ Enabled: true
662
+ Lint/StringConversionInInterpolation:
663
+ Enabled: true
664
+ Lint/UnderscorePrefixedVariableName:
665
+ Enabled: false
666
+ Lint/UnusedBlockArgument:
667
+ Enabled: true
668
+ Lint/UnusedMethodArgument:
669
+ Enabled: true
670
+ Lint/UnreachableCode:
671
+ Enabled: true
672
+ Lint/UselessAccessModifier:
673
+ Enabled: true
674
+ Lint/UselessAssignment:
675
+ Enabled: true
676
+ Lint/UselessComparison:
677
+ Enabled: true
678
+ Lint/UselessElseWithoutRescue:
679
+ Enabled: true
680
+ Lint/UselessSetterCall:
681
+ Enabled: true
682
+ Lint/Void:
683
+ Enabled: false
684
+ Rails/Delegate:
685
+ Enabled: false
data/.travis.yml CHANGED
@@ -1,7 +1,10 @@
1
1
  language: ruby
2
+ sudo: false
3
+ cache: bundler
2
4
  rvm:
3
5
  - 2.0.0
4
- - 2.1.2
6
+ - 2.1.6
7
+ - 2.2.2
5
8
  matrix:
6
9
  include:
7
10
  - rvm: jruby
data/excon-rails.gemspec CHANGED
@@ -4,25 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'excon/rails/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "excon-rails"
7
+ spec.name = 'excon-rails'
8
8
  spec.version = Excon::Rails::VERSION
9
- spec.authors = ["Ville Lautanala"]
10
- spec.email = ["lautis@gmail.com"]
11
- spec.summary = %q{Railtie to include Excon HTTP requests in Rails logging.}
12
- spec.description = %q{Log HTTP requests made via Excon and their total runtime in Rails request log.}
13
- spec.homepage = "https://github.com/lautis/excon-rails"
14
- spec.license = "MIT"
9
+ spec.authors = ['Ville Lautanala']
10
+ spec.email = ['lautis@gmail.com']
11
+ spec.summary = 'Railtie to include Excon HTTP requests in Rails logging.'
12
+ spec.description = 'Log HTTP requests made via Excon and their total runtime in Rails request log.'
13
+ spec.homepage = 'https://github.com/lautis/excon-rails'
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
- spec.require_paths = ["lib"]
17
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
19
+ spec.require_paths = ['lib']
20
20
 
21
- spec.add_dependency "excon", ">= 0.18.0"
22
- spec.add_dependency "activesupport", ">= 3.0"
23
- spec.add_dependency "sweet_notifications", "~> 0.2"
24
- spec.add_development_dependency "bundler", "~> 1.6"
25
- spec.add_development_dependency "rake"
26
- spec.add_development_dependency "rspec", "~> 3.0"
27
- spec.add_development_dependency "webmock", "~> 1.18"
21
+ spec.add_dependency 'excon', '>= 0.18.0'
22
+ spec.add_dependency 'activesupport', '>= 3.0'
23
+ spec.add_dependency 'sweet_notifications', '~> 0.2'
24
+ spec.add_development_dependency 'bundler', '~> 1.6'
25
+ spec.add_development_dependency 'rake'
26
+ spec.add_development_dependency 'rspec', '~> 3.0'
27
+ spec.add_development_dependency 'webmock', '~> 1.18'
28
28
  end
@@ -2,34 +2,43 @@ require 'excon'
2
2
 
3
3
  module Excon
4
4
  module Rails
5
+ # Middleware for tracking requests
5
6
  class Middleware < Excon::Middleware::Base
6
7
  class << self
7
8
  def install
8
- index = ::Excon.defaults[:middlewares].index(::Excon::Middleware::Instrumentor)
9
+ index = ::Excon.defaults[:middlewares]
10
+ .index(::Excon::Middleware::Instrumentor)
9
11
  ::Excon.defaults[:middlewares].insert(index || -1, self)
10
12
  end
11
13
  end
12
14
 
13
15
  def error_call(datum)
14
- ActiveSupport::Notifications.instrument('error.excon', error: datum[:error])
16
+ ActiveSupport::Notifications
17
+ .instrument('error.excon', error: datum[:error])
15
18
  @stack.error_call(datum)
16
19
  end
17
20
 
18
21
  def request_call(datum)
19
- event_name = if datum[:retries_remaining] < datum[:retry_limit]
20
- 'retry.excon'
21
- else
22
- 'request.excon'
23
- end
24
- ActiveSupport::Notifications.instrument(event_name, datum) do
22
+ ActiveSupport::Notifications.instrument(event_name(datum), datum) do
25
23
  @stack.request_call(datum)
26
24
  end
27
25
  end
28
26
 
29
27
  def response_call(datum)
30
- ActiveSupport::Notifications.instrument('response.excon', datum[:response])
28
+ ActiveSupport::Notifications
29
+ .instrument('response.excon', datum[:response])
31
30
  @stack.response_call(datum)
32
31
  end
32
+
33
+ private
34
+
35
+ def event_name(datum)
36
+ if datum[:retries_remaining] < datum[:retry_limit]
37
+ 'retry.excon'
38
+ else
39
+ 'request.excon'
40
+ end
41
+ end
33
42
  end
34
43
  end
35
44
  end
@@ -1,5 +1,5 @@
1
1
  module Excon
2
2
  module Rails
3
- VERSION = '0.1.0'
3
+ VERSION = '0.1.1'
4
4
  end
5
5
  end
data/lib/excon/rails.rb CHANGED
@@ -1,15 +1,15 @@
1
1
  require 'excon/rails/version'
2
2
  require 'excon/rails/middleware'
3
3
  require 'sweet_notifications'
4
- require 'active_support/number_helper'
5
- require 'active_support/core_ext/string/inflections'
4
+ require 'active_support'
6
5
  require 'excon'
7
6
 
8
7
  module Excon
9
8
  module Rails
10
9
  Middleware.install
11
10
 
12
- Railtie, LogSubscriber = SweetNotifications.subscribe :excon, label: 'Excon' do
11
+ Railtie, LogSubscriber = SweetNotifications.subscribe :excon,
12
+ label: 'Excon' do
13
13
  color ActiveSupport::LogSubscriber::BLUE
14
14
 
15
15
  event :request do |event|
@@ -19,7 +19,8 @@ module Excon
19
19
 
20
20
  event :response do |event|
21
21
  next unless logger.debug?
22
- debug message(event, 'Excon Response', "#{status(event)} (#{length(event)})")
22
+ debug message(event, 'Excon Response',
23
+ "#{status(event)} (#{length(event)})")
23
24
  end
24
25
 
25
26
  event :retry do |event|
@@ -48,11 +49,11 @@ module Excon
48
49
  def request_info(event)
49
50
  payload = event.payload
50
51
  url = "#{payload[:scheme]}://#{payload[:host]}#{payload[:path]}"
52
+ url << "?#{payload[:query]}" if payload[:query]
51
53
  type = event.name.split('.').first.titleize
52
54
  method = event.payload[:method].try(:upcase)
53
55
  message(event, "Excon #{type}", [method, url].compact.join(' '))
54
56
  end
55
57
  end
56
-
57
58
  end
58
59
  end
@@ -1,4 +1,16 @@
1
1
  describe Excon::Rails::Middleware do
2
+ Notifications = ActiveSupport::Notifications
3
+
4
+ def with_subscription(channel)
5
+ payloads = []
6
+ Notifications.subscribe channel do |_name, _start, _finish, _id, payload|
7
+ payloads << payload
8
+ end
9
+ yield
10
+ Notifications.unsubscribe channel
11
+ payloads
12
+ end
13
+
2
14
  before :each do
3
15
  stub_request(:any, 'example.com').to_return(body: 'abc', status: 200)
4
16
  stub_request(:any, 'example.com/timeout').to_timeout
@@ -6,49 +18,40 @@ describe Excon::Rails::Middleware do
6
18
  end
7
19
 
8
20
  it 'emits events for requests' do
9
- received = 0
10
- ActiveSupport::Notifications.subscribe 'request.excon' do
11
- received += 1
21
+ received = with_subscription 'request.excon' do
22
+ Excon.get('http://example.com')
12
23
  end
13
- Excon.get('http://example.com')
14
- ActiveSupport::Notifications.unsubscribe 'request.excon'
15
- expect(received).to eq(1)
24
+ expect(received.length).to eq(1)
16
25
  end
17
26
 
18
27
  it 'emits events for responses' do
19
- statuses = []
20
- ActiveSupport::Notifications.subscribe 'response.excon' do |name, start, finish, id, payload|
21
- statuses << payload[:status]
28
+ payloads = with_subscription 'response.excon' do
29
+ Excon.get('http://example.com')
22
30
  end
23
- Excon.get('http://example.com')
31
+ statuses = payloads.map { |payload| payload[:status] }
24
32
  ActiveSupport::Notifications.unsubscribe 'response.excon'
25
33
  expect(statuses).to eq([200])
26
34
  end
27
35
 
28
36
  it 'emits events for retried requests' do
29
- retries = 0
30
- ActiveSupport::Notifications.subscribe 'retry.excon' do
31
- retries += 1
37
+ retries = with_subscription 'retry.excon' do
38
+ connection = Excon.new('http://example.com/retry')
39
+ begin
40
+ connection.request(expects: [200], idempotent: true, retry_limit: 3)
41
+ rescue Excon::Errors::BadRequest
42
+ end
32
43
  end
33
- connection = Excon.new('http://example.com/retry')
34
- begin
35
- connection.request(expects: [200], idempotent: true, retry_limit: 3)
36
- rescue Excon::Errors::BadRequest
37
- end
38
- expect(retries).to eq(2)
39
- ActiveSupport::Notifications.unsubscribe 'retry.excon'
44
+
45
+ expect(retries.length).to eq(2)
40
46
  end
41
47
 
42
48
  it 'emits events for errors' do
43
- errors = 0
44
- ActiveSupport::Notifications.subscribe 'error.excon' do
45
- errors += 1
46
- end
47
- begin
48
- Excon.get('http://example.com/timeout')
49
- rescue Excon::Errors::Timeout
49
+ errors = with_subscription 'error.excon' do
50
+ begin
51
+ Excon.get('http://example.com/timeout')
52
+ rescue Excon::Errors::Timeout
53
+ end
50
54
  end
51
- expect(errors).to eq(1)
52
- ActiveSupport::Notifications.unsubscribe 'error.excon'
55
+ expect(errors.length).to eq(1)
53
56
  end
54
57
  end
@@ -1,7 +1,7 @@
1
1
  module Excon
2
2
  describe Rails do
3
3
  before do
4
- stub_request(:any, 'example.com').to_return(body: 'OK')
4
+ stub_request(:any, /example\.com.*/).to_return(body: 'OK')
5
5
  end
6
6
 
7
7
  after do
@@ -34,6 +34,14 @@ module Excon
34
34
  .to match(%r{Excon Request \(\d+\.\d+ms\) GET http://example\.com/})
35
35
  end
36
36
 
37
+ it 'logs query params to logger' do
38
+ @logger.level = Logger::DEBUG
39
+ Rails::Railtie.run_initializers
40
+ Excon.get('http://example.com?foo=bar&baz=bar')
41
+ expect(@logger.logged(:debug)[0])
42
+ .to match(%r{Excon Request \(\d+\.\d+ms\) GET http://example\.com/\?foo=bar&baz=bar})
43
+ end
44
+
37
45
  it 'deals with missing method' do
38
46
  @logger.level = Logger::DEBUG
39
47
  Rails::Railtie.run_initializers
data/spec/spec_helper.rb CHANGED
@@ -8,7 +8,6 @@ RSpec.configure do |config|
8
8
  config.order = :random
9
9
  Kernel.srand config.seed
10
10
 
11
-
12
11
  config.expect_with :rspec do |expectations|
13
12
  expectations.syntax = :expect
14
13
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: excon-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ville Lautanala
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-16 00:00:00.000000000 Z
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: excon
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: 0.18.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.18.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '3.0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '3.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: sweet_notifications
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0.2'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.6'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.6'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: '3.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
96
  version: '3.0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: webmock
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: '1.18'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: '1.18'
111
111
  description: Log HTTP requests made via Excon and their total runtime in Rails request
@@ -116,9 +116,10 @@ executables: []
116
116
  extensions: []
117
117
  extra_rdoc_files: []
118
118
  files:
119
- - .gitignore
120
- - .rspec
121
- - .travis.yml
119
+ - ".gitignore"
120
+ - ".rspec"
121
+ - ".rubocop.yml"
122
+ - ".travis.yml"
122
123
  - Gemfile
123
124
  - LICENSE.txt
124
125
  - README.md
@@ -141,17 +142,17 @@ require_paths:
141
142
  - lib
142
143
  required_ruby_version: !ruby/object:Gem::Requirement
143
144
  requirements:
144
- - - '>='
145
+ - - ">="
145
146
  - !ruby/object:Gem::Version
146
147
  version: '0'
147
148
  required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  requirements:
149
- - - '>='
150
+ - - ">="
150
151
  - !ruby/object:Gem::Version
151
152
  version: '0'
152
153
  requirements: []
153
154
  rubyforge_project:
154
- rubygems_version: 2.1.11
155
+ rubygems_version: 2.4.5
155
156
  signing_key:
156
157
  specification_version: 4
157
158
  summary: Railtie to include Excon HTTP requests in Rails logging.