stripe-rails 1.5.5 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +68 -84
- data/.travis.yml +2 -1
- data/Changelog.md +5 -0
- data/README.md +39 -0
- data/app/assets/stripe/stripe_elements.css +22 -0
- data/app/assets/stripe/stripe_elements.js +46 -0
- data/app/helpers/stripe/javascript_helper.rb +14 -1
- data/app/views/stripe/_elements.html.erb +17 -0
- data/app/views/stripe/_elements_js.html.erb +0 -0
- data/config/locales/en.yml +6 -0
- data/lib/stripe/engine.rb +6 -0
- data/lib/stripe/rails/version.rb +1 -1
- data/test/javascript_helper_spec.rb +30 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c921c6c2d6db4017d7a172379841880bf1c1b9daa4982bc41b5d14d31d54a63d
|
4
|
+
data.tar.gz: 00d27eefbfb5558f422b704447caa73d45159fd1773ce47e1d70a9370bc2bb40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 839bfadc000f6e76cd8a5414ec6e44e9687d97558cae102d8a1cc2741226c7ae3dc1481f6d05c8910acc2b55b85d6fe61ccc51579c3feb197d6cf76df0550b18
|
7
|
+
data.tar.gz: 6ab5709d3cc5367c4d34ba0065e0f886bc33b828925953bffceb86ef811a9d3e66d9a06b27bfe33c58ec7a46937896a82cfa0fdddca6a4e9cb22b59f6396f6f0
|
data/.rubocop.yml
CHANGED
@@ -21,7 +21,7 @@ Lint/AssignmentInCondition:
|
|
21
21
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#safe-assignment-in-condition'
|
22
22
|
Enabled: true
|
23
23
|
|
24
|
-
|
24
|
+
Layout/BlockAlignment:
|
25
25
|
Description: 'Align block ends correctly.'
|
26
26
|
Enabled: true
|
27
27
|
|
@@ -29,7 +29,7 @@ Lint/CircularArgumentReference:
|
|
29
29
|
Description: "Don't refer to the keyword argument in the default value."
|
30
30
|
Enabled: true
|
31
31
|
|
32
|
-
|
32
|
+
Layout/ConditionPosition:
|
33
33
|
Description: >-
|
34
34
|
Checks for condition placed in a confusing position relative to
|
35
35
|
the keyword.
|
@@ -40,7 +40,7 @@ Lint/Debugger:
|
|
40
40
|
Description: 'Check for debugger calls.'
|
41
41
|
Enabled: true
|
42
42
|
|
43
|
-
|
43
|
+
Layout/DefEndAlignment:
|
44
44
|
Description: 'Align ends corresponding to defs correctly.'
|
45
45
|
Enabled: true
|
46
46
|
|
@@ -68,7 +68,7 @@ Lint/EmptyInterpolation:
|
|
68
68
|
Description: 'Checks for empty string interpolation.'
|
69
69
|
Enabled: true
|
70
70
|
|
71
|
-
|
71
|
+
Layout/EndAlignment:
|
72
72
|
Description: 'Align ends correctly.'
|
73
73
|
Enabled: true
|
74
74
|
|
@@ -81,7 +81,7 @@ Lint/EnsureReturn:
|
|
81
81
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-return-ensure'
|
82
82
|
Enabled: true
|
83
83
|
|
84
|
-
|
84
|
+
Security/Eval:
|
85
85
|
Description: 'The use of eval represents a serious security risk.'
|
86
86
|
Enabled: true
|
87
87
|
|
@@ -94,13 +94,7 @@ Lint/HandleExceptions:
|
|
94
94
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#dont-hide-exceptions'
|
95
95
|
Enabled: true
|
96
96
|
|
97
|
-
Lint/
|
98
|
-
Description: >-
|
99
|
-
Checks for invalid character literals with a non-escaped
|
100
|
-
whitespace character.
|
101
|
-
Enabled: true
|
102
|
-
|
103
|
-
Lint/LiteralInCondition:
|
97
|
+
Lint/LiteralAsCondition:
|
104
98
|
Description: 'Checks of literals used in conditions.'
|
105
99
|
Enabled: true
|
106
100
|
|
@@ -157,7 +151,7 @@ Lint/UnderscorePrefixedVariableName:
|
|
157
151
|
Description: 'Do not use prefix `_` for a variable that is used.'
|
158
152
|
Enabled: true
|
159
153
|
|
160
|
-
Lint/
|
154
|
+
Lint/UnneededCopDisableDirective:
|
161
155
|
Description: >-
|
162
156
|
Checks for rubocop:disable comments that can be removed.
|
163
157
|
Note: this cop is not disabled when disabling all cops.
|
@@ -367,12 +361,12 @@ Rails/Validation:
|
|
367
361
|
|
368
362
|
################## Style #################################
|
369
363
|
|
370
|
-
|
364
|
+
Layout/AccessModifierIndentation:
|
371
365
|
Description: Check indentation of private/protected visibility modifiers.
|
372
366
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-public-private-protected'
|
373
367
|
Enabled: false
|
374
368
|
|
375
|
-
|
369
|
+
Naming/AccessorMethodName:
|
376
370
|
Description: Check the naming of accessor methods for get_/set_.
|
377
371
|
Enabled: false
|
378
372
|
|
@@ -381,20 +375,20 @@ Style/Alias:
|
|
381
375
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#alias-method'
|
382
376
|
Enabled: false
|
383
377
|
|
384
|
-
|
378
|
+
Layout/AlignArray:
|
385
379
|
Description: >-
|
386
380
|
Align the elements of an array literal if they span more than
|
387
381
|
one line.
|
388
382
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#align-multiline-arrays'
|
389
383
|
Enabled: false
|
390
384
|
|
391
|
-
|
385
|
+
Layout/AlignHash:
|
392
386
|
Description: >-
|
393
387
|
Align the elements of a hash literal if they span more than
|
394
388
|
one line.
|
395
389
|
Enabled: false
|
396
390
|
|
397
|
-
|
391
|
+
Layout/AlignParameters:
|
398
392
|
Description: >-
|
399
393
|
Align the parameters of a method call if they span more
|
400
394
|
than one line.
|
@@ -416,7 +410,7 @@ Style/AsciiComments:
|
|
416
410
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-comments'
|
417
411
|
Enabled: false
|
418
412
|
|
419
|
-
|
413
|
+
Naming/AsciiIdentifiers:
|
420
414
|
Description: 'Use only ascii symbols in identifiers.'
|
421
415
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#english-identifiers'
|
422
416
|
Enabled: false
|
@@ -441,7 +435,7 @@ Style/BlockComments:
|
|
441
435
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-block-comments'
|
442
436
|
Enabled: false
|
443
437
|
|
444
|
-
|
438
|
+
Layout/BlockEndNewline:
|
445
439
|
Description: 'Put end statement of multiline block on its own line.'
|
446
440
|
Enabled: false
|
447
441
|
|
@@ -462,7 +456,7 @@ Style/CaseEquality:
|
|
462
456
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-case-equality'
|
463
457
|
Enabled: false
|
464
458
|
|
465
|
-
|
459
|
+
Layout/CaseIndentation:
|
466
460
|
Description: 'Indentation of when in a case/when/[else/]end.'
|
467
461
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#indent-when-to-case'
|
468
462
|
Enabled: false
|
@@ -472,7 +466,7 @@ Style/CharacterLiteral:
|
|
472
466
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-character-literals'
|
473
467
|
Enabled: false
|
474
468
|
|
475
|
-
|
469
|
+
Naming/ClassAndModuleCamelCase:
|
476
470
|
Description: 'Use CamelCase for classes and modules.'
|
477
471
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#camelcase-classes'
|
478
472
|
Enabled: false
|
@@ -495,7 +489,7 @@ Style/ClassVars:
|
|
495
489
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-class-vars'
|
496
490
|
Enabled: false
|
497
491
|
|
498
|
-
|
492
|
+
Layout/ClosingParenthesisIndentation:
|
499
493
|
Description: 'Checks the indentation of hanging closing parentheses.'
|
500
494
|
Enabled: false
|
501
495
|
|
@@ -514,11 +508,11 @@ Style/CommentAnnotation:
|
|
514
508
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#annotate-keywords'
|
515
509
|
Enabled: false
|
516
510
|
|
517
|
-
|
511
|
+
Layout/CommentIndentation:
|
518
512
|
Description: 'Indentation of comments.'
|
519
513
|
Enabled: false
|
520
514
|
|
521
|
-
|
515
|
+
Naming/ConstantName:
|
522
516
|
Description: 'Constants should use SCREAMING_SNAKE_CASE.'
|
523
517
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#screaming-snake-case'
|
524
518
|
Enabled: false
|
@@ -537,7 +531,7 @@ Style/Documentation:
|
|
537
531
|
Description: 'Document classes and non-namespace modules.'
|
538
532
|
Enabled: false
|
539
533
|
|
540
|
-
|
534
|
+
Layout/DotPosition:
|
541
535
|
Description: 'Checks the position of the dot in multi-line method calls.'
|
542
536
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#consistent-multi-line-chains'
|
543
537
|
Enabled: false
|
@@ -551,7 +545,7 @@ Style/EachWithObject:
|
|
551
545
|
Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
|
552
546
|
Enabled: false
|
553
547
|
|
554
|
-
|
548
|
+
Layout/ElseAlignment:
|
555
549
|
Description: 'Align elses and elsifs correctly.'
|
556
550
|
Enabled: false
|
557
551
|
|
@@ -559,32 +553,32 @@ Style/EmptyElse:
|
|
559
553
|
Description: 'Avoid empty else-clauses.'
|
560
554
|
Enabled: false
|
561
555
|
|
562
|
-
|
556
|
+
Layout/EmptyLineBetweenDefs:
|
563
557
|
Description: 'Use empty lines between defs.'
|
564
558
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#empty-lines-between-methods'
|
565
559
|
Enabled: false
|
566
560
|
|
567
|
-
|
561
|
+
Layout/EmptyLines:
|
568
562
|
Description: "Don't use several empty lines in a row."
|
569
563
|
Enabled: false
|
570
564
|
|
571
|
-
|
565
|
+
Layout/EmptyLinesAroundAccessModifier:
|
572
566
|
Description: "Keep blank lines around access modifiers."
|
573
567
|
Enabled: false
|
574
568
|
|
575
|
-
|
569
|
+
Layout/EmptyLinesAroundBlockBody:
|
576
570
|
Description: "Keeps track of empty lines around block bodies."
|
577
571
|
Enabled: false
|
578
572
|
|
579
|
-
|
573
|
+
Layout/EmptyLinesAroundClassBody:
|
580
574
|
Description: "Keeps track of empty lines around class bodies."
|
581
575
|
Enabled: false
|
582
576
|
|
583
|
-
|
577
|
+
Layout/EmptyLinesAroundModuleBody:
|
584
578
|
Description: "Keeps track of empty lines around module bodies."
|
585
579
|
Enabled: false
|
586
580
|
|
587
|
-
|
581
|
+
Layout/EmptyLinesAroundMethodBody:
|
588
582
|
Description: "Keeps track of empty lines around method bodies."
|
589
583
|
Enabled: false
|
590
584
|
|
@@ -598,7 +592,7 @@ Style/EndBlock:
|
|
598
592
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-END-blocks'
|
599
593
|
Enabled: false
|
600
594
|
|
601
|
-
|
595
|
+
Layout/EndOfLine:
|
602
596
|
Description: 'Use Unix-style line endings.'
|
603
597
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#crlf'
|
604
598
|
Enabled: false
|
@@ -608,21 +602,21 @@ Style/EvenOdd:
|
|
608
602
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#predicate-methods'
|
609
603
|
Enabled: false
|
610
604
|
|
611
|
-
|
605
|
+
Layout/ExtraSpacing:
|
612
606
|
Description: 'Do not use unnecessary spacing.'
|
613
607
|
Enabled: false
|
614
608
|
|
615
|
-
|
609
|
+
Naming/FileName:
|
616
610
|
Description: 'Use snake_case for source file names.'
|
617
611
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-files'
|
618
612
|
Enabled: false
|
619
613
|
|
620
|
-
|
614
|
+
Layout/InitialIndentation:
|
621
615
|
Description: >-
|
622
616
|
Checks the indentation of the first non-blank non-comment line in a file.
|
623
617
|
Enabled: false
|
624
618
|
|
625
|
-
|
619
|
+
Layout/FirstParameterIndentation:
|
626
620
|
Description: 'Checks the indentation of the first parameter in a method call.'
|
627
621
|
Enabled: false
|
628
622
|
|
@@ -671,22 +665,22 @@ Style/IfWithSemicolon:
|
|
671
665
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-semicolon-ifs'
|
672
666
|
Enabled: false
|
673
667
|
|
674
|
-
|
668
|
+
Layout/IndentationConsistency:
|
675
669
|
Description: 'Keep indentation straight.'
|
676
670
|
Enabled: false
|
677
671
|
|
678
|
-
|
672
|
+
Layout/IndentationWidth:
|
679
673
|
Description: 'Use 2 spaces for indentation.'
|
680
674
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
681
675
|
Enabled: false
|
682
676
|
|
683
|
-
|
677
|
+
Layout/IndentArray:
|
684
678
|
Description: >-
|
685
679
|
Checks the indentation of the first element in an array
|
686
680
|
literal.
|
687
681
|
Enabled: false
|
688
682
|
|
689
|
-
|
683
|
+
Layout/IndentHash:
|
690
684
|
Description: 'Checks the indentation of the first key in a hash literal.'
|
691
685
|
Enabled: false
|
692
686
|
|
@@ -705,7 +699,7 @@ Style/LambdaCall:
|
|
705
699
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#proc-call'
|
706
700
|
Enabled: false
|
707
701
|
|
708
|
-
|
702
|
+
Layout/LeadingCommentSpace:
|
709
703
|
Description: 'Comments should start with a space.'
|
710
704
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#hash-space'
|
711
705
|
Enabled: false
|
@@ -716,7 +710,7 @@ Style/LineEndConcatenation:
|
|
716
710
|
line end.
|
717
711
|
Enabled: false
|
718
712
|
|
719
|
-
Style/
|
713
|
+
Style/MethodCallWithoutArgsParentheses:
|
720
714
|
Description: 'Do not use parentheses for method calls with no arguments.'
|
721
715
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-args-no-parens'
|
722
716
|
Enabled: false
|
@@ -728,7 +722,7 @@ Style/MethodDefParentheses:
|
|
728
722
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#method-parens'
|
729
723
|
Enabled: false
|
730
724
|
|
731
|
-
|
725
|
+
Naming/MethodName:
|
732
726
|
Description: 'Use the configured style when naming methods.'
|
733
727
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
|
734
728
|
Enabled: false
|
@@ -743,7 +737,7 @@ Style/MultilineBlockChain:
|
|
743
737
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#single-line-blocks'
|
744
738
|
Enabled: false
|
745
739
|
|
746
|
-
|
740
|
+
Layout/MultilineBlockLayout:
|
747
741
|
Description: 'Ensures newlines after multiline block do statements.'
|
748
742
|
Enabled: false
|
749
743
|
|
@@ -752,7 +746,7 @@ Style/MultilineIfThen:
|
|
752
746
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-then'
|
753
747
|
Enabled: false
|
754
748
|
|
755
|
-
|
749
|
+
Layout/MultilineOperationIndentation:
|
756
750
|
Description: >-
|
757
751
|
Checks indentation of binary operations that span more than
|
758
752
|
one line.
|
@@ -816,7 +810,7 @@ Style/OneLineConditional:
|
|
816
810
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#ternary-operator'
|
817
811
|
Enabled: false
|
818
812
|
|
819
|
-
|
813
|
+
Naming/BinaryOperatorParameterName:
|
820
814
|
Description: 'When defining binary operators, name the argument other.'
|
821
815
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#other-arg'
|
822
816
|
Enabled: false
|
@@ -858,7 +852,7 @@ Style/PerlBackrefs:
|
|
858
852
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-perl-regexp-last-matchers'
|
859
853
|
Enabled: false
|
860
854
|
|
861
|
-
|
855
|
+
Naming/PredicateName:
|
862
856
|
Description: 'Check the names of predicate methods.'
|
863
857
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#bool-methods-qmark'
|
864
858
|
Enabled: false
|
@@ -898,7 +892,7 @@ Style/RegexpLiteral:
|
|
898
892
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#percent-r'
|
899
893
|
Enabled: false
|
900
894
|
|
901
|
-
|
895
|
+
Layout/RescueEnsureAlignment:
|
902
896
|
Description: 'Align rescues and ensures correctly.'
|
903
897
|
Enabled: false
|
904
898
|
|
@@ -934,75 +928,75 @@ Style/SingleLineMethods:
|
|
934
928
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-single-line-methods'
|
935
929
|
Enabled: false
|
936
930
|
|
937
|
-
|
931
|
+
Layout/SpaceBeforeFirstArg:
|
938
932
|
Description: >-
|
939
933
|
Checks that exactly one space is used between a method name
|
940
934
|
and the first argument for method calls without parentheses.
|
941
935
|
Enabled: true
|
942
936
|
|
943
|
-
|
937
|
+
Layout/SpaceAfterColon:
|
944
938
|
Description: 'Use spaces after colons.'
|
945
939
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
946
940
|
Enabled: false
|
947
941
|
|
948
|
-
|
942
|
+
Layout/SpaceAfterComma:
|
949
943
|
Description: 'Use spaces after commas.'
|
950
944
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
951
945
|
Enabled: false
|
952
946
|
|
953
|
-
|
947
|
+
Layout/SpaceAroundKeyword:
|
954
948
|
Description: 'Use spaces around keywords.'
|
955
949
|
Enabled: false
|
956
950
|
|
957
|
-
|
951
|
+
Layout/SpaceAfterMethodName:
|
958
952
|
Description: >-
|
959
953
|
Do not put a space between a method name and the opening
|
960
954
|
parenthesis in a method definition.
|
961
955
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#parens-no-spaces'
|
962
956
|
Enabled: false
|
963
957
|
|
964
|
-
|
958
|
+
Layout/SpaceAfterNot:
|
965
959
|
Description: Tracks redundant space after the ! operator.
|
966
960
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-bang'
|
967
961
|
Enabled: false
|
968
962
|
|
969
|
-
|
963
|
+
Layout/SpaceAfterSemicolon:
|
970
964
|
Description: 'Use spaces after semicolons.'
|
971
965
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
972
966
|
Enabled: false
|
973
967
|
|
974
|
-
|
968
|
+
Layout/SpaceBeforeBlockBraces:
|
975
969
|
Description: >-
|
976
970
|
Checks that the left block brace has or doesn't have space
|
977
971
|
before it.
|
978
972
|
Enabled: false
|
979
973
|
|
980
|
-
|
974
|
+
Layout/SpaceBeforeComma:
|
981
975
|
Description: 'No spaces before commas.'
|
982
976
|
Enabled: false
|
983
977
|
|
984
|
-
|
978
|
+
Layout/SpaceBeforeComment:
|
985
979
|
Description: >-
|
986
980
|
Checks for missing space between code and a comment on the
|
987
981
|
same line.
|
988
982
|
Enabled: false
|
989
983
|
|
990
|
-
|
984
|
+
Layout/SpaceBeforeSemicolon:
|
991
985
|
Description: 'No spaces before semicolons.'
|
992
986
|
Enabled: false
|
993
987
|
|
994
|
-
|
988
|
+
Layout/SpaceInsideBlockBraces:
|
995
989
|
Description: >-
|
996
990
|
Checks that block braces have or don't have surrounding space.
|
997
991
|
For blocks taking parameters, checks that the left brace has
|
998
992
|
or doesn't have trailing space.
|
999
993
|
Enabled: false
|
1000
994
|
|
1001
|
-
|
995
|
+
Layout/SpaceAroundBlockParameters:
|
1002
996
|
Description: 'Checks the spacing inside and after block parameters pipes.'
|
1003
997
|
Enabled: false
|
1004
998
|
|
1005
|
-
|
999
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
1006
1000
|
Description: >-
|
1007
1001
|
Checks that the equals signs in parameter default assignments
|
1008
1002
|
have or don't have surrounding space depending on
|
@@ -1010,32 +1004,27 @@ Style/SpaceAroundEqualsInParameterDefault:
|
|
1010
1004
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-around-equals'
|
1011
1005
|
Enabled: false
|
1012
1006
|
|
1013
|
-
|
1007
|
+
Layout/SpaceAroundOperators:
|
1014
1008
|
Description: 'Use a single space around operators.'
|
1015
1009
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1016
1010
|
Enabled: false
|
1017
1011
|
|
1018
|
-
|
1019
|
-
Description: 'No spaces after [ or before ].'
|
1020
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
1021
|
-
Enabled: false
|
1022
|
-
|
1023
|
-
Style/SpaceInsideHashLiteralBraces:
|
1012
|
+
Layout/SpaceInsideHashLiteralBraces:
|
1024
1013
|
Description: "Use spaces inside hash literal braces - or don't."
|
1025
1014
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-operators'
|
1026
1015
|
Enabled: false
|
1027
1016
|
|
1028
|
-
|
1017
|
+
Layout/SpaceInsideParens:
|
1029
1018
|
Description: 'No spaces after ( or before ).'
|
1030
1019
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-spaces-braces'
|
1031
1020
|
Enabled: false
|
1032
1021
|
|
1033
|
-
|
1022
|
+
Layout/SpaceInsideRangeLiteral:
|
1034
1023
|
Description: 'No spaces inside range literals.'
|
1035
1024
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-space-inside-range-literals'
|
1036
1025
|
Enabled: false
|
1037
1026
|
|
1038
|
-
|
1027
|
+
Layout/SpaceInsideStringInterpolation:
|
1039
1028
|
Description: 'Checks for padding/surrounding spaces inside string interpolation.'
|
1040
1029
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#string-interpolation'
|
1041
1030
|
Enabled: false
|
@@ -1069,12 +1058,12 @@ Style/SymbolProc:
|
|
1069
1058
|
Description: 'Use symbols as procs instead of blocks when possible.'
|
1070
1059
|
Enabled: false
|
1071
1060
|
|
1072
|
-
|
1061
|
+
Layout/Tab:
|
1073
1062
|
Description: 'No hard tabs.'
|
1074
1063
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#spaces-indentation'
|
1075
1064
|
Enabled: false
|
1076
1065
|
|
1077
|
-
|
1066
|
+
Layout/TrailingBlankLines:
|
1078
1067
|
Description: 'Checks trailing blank lines and final newline.'
|
1079
1068
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#newline-eof'
|
1080
1069
|
Enabled: false
|
@@ -1084,12 +1073,7 @@ Style/TrailingCommaInArguments:
|
|
1084
1073
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-params-comma'
|
1085
1074
|
Enabled: false
|
1086
1075
|
|
1087
|
-
|
1088
|
-
Description: 'Checks for trailing comma in literals.'
|
1089
|
-
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-array-commas'
|
1090
|
-
Enabled: false
|
1091
|
-
|
1092
|
-
Style/TrailingWhitespace:
|
1076
|
+
Layout/TrailingWhitespace:
|
1093
1077
|
Description: 'Avoid trailing whitespace.'
|
1094
1078
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#no-trailing-whitespace'
|
1095
1079
|
Enabled: false
|
@@ -1128,7 +1112,7 @@ Style/VariableInterpolation:
|
|
1128
1112
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#curlies-interpolate'
|
1129
1113
|
Enabled: false
|
1130
1114
|
|
1131
|
-
|
1115
|
+
Naming/VariableName:
|
1132
1116
|
Description: 'Use the configured style when naming variables.'
|
1133
1117
|
StyleGuide: 'https://github.com/bbatsov/ruby-style-guide#snake-case-symbols-methods-vars'
|
1134
1118
|
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
+
- 2.6.0
|
3
4
|
- 2.5.3
|
4
5
|
- 2.4.5
|
5
6
|
- 2.3.8
|
@@ -17,7 +18,7 @@ before_script:
|
|
17
18
|
script:
|
18
19
|
- bundle exec rake
|
19
20
|
- if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ `basename $BUNDLE_GEMFILE` == "Gemfile"
|
20
|
-
] && [ ${RUBY_VERSION:5:3} == "2.
|
21
|
+
] && [ ${RUBY_VERSION:5:3} == "2.6" ] ; then echo "Sending Coverage..."; ./cc-test-reporter
|
21
22
|
after-build --exit-code $TRAVIS_TEST_RESULT; fi
|
22
23
|
gemfile:
|
23
24
|
- Gemfile
|
data/Changelog.md
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
## 1.6.0 (2010-01-08)
|
2
|
+
|
3
|
+
* New Year New Feature: Easily include Stripe Elements into your project thanks to @garrettqmartin8 !
|
4
|
+
* Travis is now testing the gem on Ruby 2.6.0
|
5
|
+
|
1
6
|
## 1.5.5 (2018-12-16)
|
2
7
|
|
3
8
|
* Fixed issue with Rails development and Spring: Clear callbacks before files are reloaded during development and test - thanks @ndbroadbent
|
data/README.md
CHANGED
@@ -23,7 +23,10 @@ This gem can help your rails application integrate with Stripe in the following
|
|
23
23
|
[Setup your payment configuration](#setup-your-payment-configuration)
|
24
24
|
- [Configuring your plans and coupons](#configuring-your-plans-and-coupons)
|
25
25
|
|
26
|
+
[Stripe Elements](#stripe-elements)
|
27
|
+
|
26
28
|
[Webhooks](#webhooks)
|
29
|
+
|
27
30
|
- [Signed Webhooks](#signed-webhooks)
|
28
31
|
- [Testing Signed Webhooks Locally](#testing-signed-webhooks-locally)
|
29
32
|
- [Disabling auto mount](#disabling-auto-mount)
|
@@ -224,6 +227,42 @@ use any of these plans in your application.
|
|
224
227
|
|
225
228
|
NOTE: You must destroy plans manually from your stripe dashboard.
|
226
229
|
|
230
|
+
## Stripe Elements
|
231
|
+
|
232
|
+
Stripe::Rails allows you to easily include [Stripe Elements](https://stripe.com/payments/elements) in your application.
|
233
|
+
|
234
|
+
> Stripe Elements are rich, pre-built UI components that help you create your own pixel-perfect checkout flows across desktop and mobile.
|
235
|
+
|
236
|
+
Simply include the `stripe_elements_tag` anywhere below the `stripe_javascript_tag` and pass it the path to the controller action which will handle the Stripe token once the form is submitted:
|
237
|
+
|
238
|
+
```erb
|
239
|
+
<%= stripe_javascript_tag %>
|
240
|
+
<%= stripe_elements_tag submit_path: billing_path %>
|
241
|
+
```
|
242
|
+
|
243
|
+
### Configuration options
|
244
|
+
|
245
|
+
Stripe::Rails comes bundled with default CSS and Javascript for Stripe elements, making it easy to drop in to your app. You can also specify your own assets paths:
|
246
|
+
|
247
|
+
```erb
|
248
|
+
<%= stripe_elements_tag submit_path: billing_path,
|
249
|
+
css_path: 'your/asset/path',
|
250
|
+
js_path: 'your/asset/path' %>
|
251
|
+
```
|
252
|
+
|
253
|
+
If you decide to use your own CSS and Javascript for Stripe Elements, please refer to the [Stripe elements docs](https://stripe.com/docs/stripe-js/elements/quickstart).
|
254
|
+
|
255
|
+
To change the form text you can add the following keys to your locale files
|
256
|
+
|
257
|
+
```yaml
|
258
|
+
# config/locales/en.yml
|
259
|
+
en:
|
260
|
+
stripe_rails:
|
261
|
+
elements:
|
262
|
+
label_text: Your label text
|
263
|
+
submit_button_text: Your button text
|
264
|
+
```
|
265
|
+
|
227
266
|
## Webhooks
|
228
267
|
|
229
268
|
Stripe::Rails automatically sets up your application to receive webhooks from stripe.com whenever
|
@@ -0,0 +1,22 @@
|
|
1
|
+
.StripeElement {
|
2
|
+
background-color: white;
|
3
|
+
height: 40px;
|
4
|
+
padding: 10px 12px;
|
5
|
+
border-radius: 4px;
|
6
|
+
border: 1px solid transparent;
|
7
|
+
box-shadow: 0 1px 3px 0 #e6ebf1;
|
8
|
+
-webkit-transition: box-shadow 150ms ease;
|
9
|
+
transition: box-shadow 150ms ease;
|
10
|
+
}
|
11
|
+
|
12
|
+
.StripeElement--focus {
|
13
|
+
box-shadow: 0 1px 3px 0 #cfd7df;
|
14
|
+
}
|
15
|
+
|
16
|
+
.StripeElement--invalid {
|
17
|
+
border-color: #fa755a;
|
18
|
+
}
|
19
|
+
|
20
|
+
.StripeElement--webkit-autofill {
|
21
|
+
background-color: #fefde5 !important;
|
22
|
+
}
|
@@ -0,0 +1,46 @@
|
|
1
|
+
// Create a Stripe client.
|
2
|
+
var stripe = Stripe(window.stripe_publishable_key);
|
3
|
+
|
4
|
+
// Create an instance of Elements.
|
5
|
+
var elements = stripe.elements();
|
6
|
+
|
7
|
+
var card = elements.create('card');
|
8
|
+
card.mount('#card-element');
|
9
|
+
|
10
|
+
card.addEventListener('change', function(event) {
|
11
|
+
var displayError = document.getElementById('card-errors');
|
12
|
+
if (event.error) {
|
13
|
+
displayError.textContent = event.error.message;
|
14
|
+
} else {
|
15
|
+
displayError.textContent = '';
|
16
|
+
}
|
17
|
+
});
|
18
|
+
|
19
|
+
var form = document.getElementById('stripe-form');
|
20
|
+
form.addEventListener('submit', function(event) {
|
21
|
+
event.preventDefault();
|
22
|
+
|
23
|
+
stripe.createToken(card).then(function(result) {
|
24
|
+
if (result.error) {
|
25
|
+
// Inform the user if there was an error.
|
26
|
+
var errorElement = document.getElementById('card-errors');
|
27
|
+
errorElement.textContent = result.error.message;
|
28
|
+
} else {
|
29
|
+
// Send the token to your server.
|
30
|
+
stripeTokenHandler(result.token);
|
31
|
+
}
|
32
|
+
});
|
33
|
+
})
|
34
|
+
|
35
|
+
function stripeTokenHandler(token) {
|
36
|
+
// Insert the token ID into the form so it gets submitted to the server
|
37
|
+
var form = document.getElementById('stripe-form');
|
38
|
+
var hiddenInput = document.createElement('input');
|
39
|
+
hiddenInput.setAttribute('type', 'hidden');
|
40
|
+
hiddenInput.setAttribute('name', 'stripeToken');
|
41
|
+
hiddenInput.setAttribute('value', token.id);
|
42
|
+
form.appendChild(hiddenInput);
|
43
|
+
|
44
|
+
// Submit the form
|
45
|
+
form.submit();
|
46
|
+
}
|
@@ -7,5 +7,18 @@ module Stripe
|
|
7
7
|
|
8
8
|
render 'stripe/js', stripe_js_version: stripe_js_version
|
9
9
|
end
|
10
|
+
|
11
|
+
def stripe_elements_tag(submit_path:,
|
12
|
+
css_path: asset_path("stripe_elements.css"),
|
13
|
+
js_path: asset_path("stripe_elements.js"))
|
14
|
+
|
15
|
+
render partial: 'stripe/elements', locals: {
|
16
|
+
submit_path: submit_path,
|
17
|
+
label_text: t('stripe_rails.elements.label_text'),
|
18
|
+
submit_button_text: t('stripe_rails.elements.submit_button_text'),
|
19
|
+
css_path: css_path,
|
20
|
+
js_path: js_path
|
21
|
+
}
|
22
|
+
end
|
10
23
|
end
|
11
|
-
end
|
24
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<%= stylesheet_link_tag css_path, media: 'all' %>
|
2
|
+
|
3
|
+
<div>
|
4
|
+
<div id="card-errors">
|
5
|
+
</div>
|
6
|
+
|
7
|
+
<%= form_tag submit_path, id: "stripe-form" do %>
|
8
|
+
<%= label_tag :card_element, label_text %>
|
9
|
+
<div id="card-element"><!-- A Stripe Element will be inserted here. --></div>
|
10
|
+
<%= submit_tag submit_button_text %>
|
11
|
+
<% end %>
|
12
|
+
</div>
|
13
|
+
|
14
|
+
<script>
|
15
|
+
window.stripe_publishable_key = '<%= Rails.application.config.stripe.publishable_key %>'
|
16
|
+
</script>
|
17
|
+
<%= javascript_include_tag js_path, id: "stripe_elements_js" %>
|
File without changes
|
data/lib/stripe/engine.rb
CHANGED
@@ -80,6 +80,12 @@ environment file directly.
|
|
80
80
|
end
|
81
81
|
end
|
82
82
|
|
83
|
+
initializer 'stripe.assets.precompile' do |app|
|
84
|
+
unless ::Rails.env.test?
|
85
|
+
app.config.assets.precompile += %w( stripe_elements.js stripe_elements.css )
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
83
89
|
rake_tasks do
|
84
90
|
load 'stripe/rails/tasks.rake'
|
85
91
|
end
|
data/lib/stripe/rails/version.rb
CHANGED
@@ -48,4 +48,34 @@ describe Stripe::JavascriptHelper do
|
|
48
48
|
subject.must_include 'https://js.stripe.com/v2/'
|
49
49
|
end
|
50
50
|
end
|
51
|
+
|
52
|
+
describe '#stripe_elements_tag' do
|
53
|
+
describe 'when no options are passed' do
|
54
|
+
it 'should display the form' do
|
55
|
+
view.stripe_elements_tag(
|
56
|
+
submit_path: '/charge',
|
57
|
+
).must_include 'Credit or debit card'
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
describe 'with options' do
|
62
|
+
describe 'without default js' do
|
63
|
+
it 'wont include the default script tag' do
|
64
|
+
view.stripe_elements_tag(
|
65
|
+
submit_path: '/charge',
|
66
|
+
js_path: 'another/path'
|
67
|
+
).wont_include '<script id="stripe_elements_js">'
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
describe 'without default css' do
|
72
|
+
it 'wont include the default style tag' do
|
73
|
+
view.stripe_elements_tag(
|
74
|
+
submit_path: '/charge',
|
75
|
+
css_path: 'another/path'
|
76
|
+
).wont_include '<style>'
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
51
81
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stripe-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Charles Lowell
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2019-01-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|
@@ -74,13 +74,18 @@ files:
|
|
74
74
|
- LICENSE
|
75
75
|
- README.md
|
76
76
|
- Rakefile
|
77
|
+
- app/assets/stripe/stripe_elements.css
|
78
|
+
- app/assets/stripe/stripe_elements.js
|
77
79
|
- app/controllers/stripe/application_controller.rb
|
78
80
|
- app/controllers/stripe/events_controller.rb
|
79
81
|
- app/controllers/stripe/pings_controller.rb
|
80
82
|
- app/helpers/stripe/javascript_helper.rb
|
81
83
|
- app/models/stripe/event_dispatch.rb
|
82
84
|
- app/models/stripe/ping.rb
|
85
|
+
- app/views/stripe/_elements.html.erb
|
86
|
+
- app/views/stripe/_elements_js.html.erb
|
83
87
|
- app/views/stripe/_js.html.erb
|
88
|
+
- config/locales/en.yml
|
84
89
|
- config/routes.rb
|
85
90
|
- gemfiles/rails4.gemfile
|
86
91
|
- lib/generators/stripe/install_generator.rb
|