stripe-opal 0.0.1 → 0.0.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: 93c3b8fa305754245e72a824a0165bbc9f800f9f
4
- data.tar.gz: 649efa0a711f21fc48ec702473e9d2e00a2662b0
3
+ metadata.gz: 82672d27b554e179c32f4d3bc60f6fdba87bb4b6
4
+ data.tar.gz: 8e9ea103b71c753df9b124487f955312c63aad31
5
5
  SHA512:
6
- metadata.gz: 6f9f5561c1fd447055c551d71fdd689e7fb825f7f57d5fce1d1eba3cc9faf574353527b97afe7cd2744ab1949f74af0983bd7bda8659ea598723d4d991e9df1d
7
- data.tar.gz: e19cda712d80e4b4d795dd95d2a459f441c314ac3c7d79ae9e3a6485d4de1761562f8b909fc8c9e79c69697799962e1dfdbb92345eb29ce5128bb199a64d0d54
6
+ metadata.gz: 2726efca7271e287f0b3d758a7f76d3791d1e7223acb4c82e2535ed0877d0b35f450aced200f65b4afa2d871bdd8bb40fd60c2dbdb246a58796da6b036573dcc
7
+ data.tar.gz: 464417e13d2cdde948b83aa6284bb555cabb80864894c51126408eddcba45af744a5e7f1b038efc26a651553d13f2acfe4a14f7877a722d20c1815fe26fa75b5
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ .DS_Store
2
+ *.gem
3
+ Gemfile.lock
4
+ build
5
+ gh-pages
6
+ /.bundle
7
+ .yardoc
8
+ /doc
data/Gemfile ADDED
@@ -0,0 +1,2 @@
1
+ source 'https://rubygems.org'
2
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,19 @@
1
+ Copyright (C) 2015 by Rick Carlino
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in
11
+ all copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # Unofficial Stripe.JS wrapper for Opal
2
+
3
+ `stripe-opal` provides credit card payment capabilities to opal by wrapping Stripe.js and providing a nice ruby syntax for dealing with card payments.
4
+
5
+ ## Note
6
+
7
+ This is an unofficial Gem and I don't work for Stripe. The gem is maintained, but not officially supported or endorsed by Stripe.
8
+
9
+ ## Getting Started
10
+
11
+ ### Usage
12
+
13
+ Add this to `app/main/config/dependencies.rb` for your **Volt Project**:
14
+
15
+ ```ruby
16
+ javascript_file "https://js.stripe.com/v2/"
17
+ ```
18
+
19
+ OR, if you are writing a **static app that does not use Volt, but uses Opal**:
20
+
21
+ ```html
22
+ <script type="text/javascript" src="https://js.stripe.com/v2/"></script>
23
+ ```
24
+ THEN
25
+
26
+ Make this HTML form...
27
+
28
+ ```html
29
+ <form action="" method="POST" id="payment-form">
30
+ <span class="payment-errors"></span>
31
+
32
+ <div class="form-row">
33
+ <label>
34
+ <span>Card Number</span>
35
+ <input type="text" size="20" data-stripe="number"/>
36
+ </label>
37
+ </div>
38
+
39
+ <div class="form-row">
40
+ <label>
41
+ <span>CVC</span>
42
+ <input type="text" size="4" data-stripe="cvc"/>
43
+ </label>
44
+ </div>
45
+
46
+ <div class="form-row">
47
+ <label>
48
+ <span>Expiration (MM/YYYY)</span>
49
+ <input type="text" size="2" data-stripe="exp-month"/>
50
+ </label>
51
+ <span> / </span>
52
+ <input type="text" size="4" data-stripe="exp-year"/>
53
+ </div>
54
+
55
+ <button type="submit">Submit Payment</button>
56
+ </form>
57
+ ```
58
+
59
+ And run payments like this:
60
+
61
+ ```ruby
62
+
63
+ StripeOpal::Card
64
+ .get_token('#payment-form') # Notice the ID on the form above?
65
+ .then { |token| "Pass the `token.id` to a Volt::Task or AJAX call" }
66
+ .fail { |error| "Tell the user they put bad info in." }
67
+
68
+ ```
69
+
70
+ If you are developing a [Volt Framework](http://www.voltframework.com) app, it's best to put the code above in a controller method
71
+
72
+ ```
73
+ def pay_from_controller
74
+ StripeOpal::Card
75
+ .get_token('#payment-form') # Notice the ID on the form above?
76
+ .then { |token| "Pass the `token.id` to a Volt::Task or AJAX call" }
77
+ .fail { |error| "Tell the user they put bad info in." }
78
+ end
79
+ ```
80
+
81
+ and add `e-submit="pay_from_controller"` to the `<form>` tag.
82
+
83
+ ## Installation
84
+
85
+ Install stripe-opal from RubyGems:
86
+
87
+ ```
88
+ $ gem install stripe-opal
89
+ ```
90
+
91
+ Or include it in your Gemfile for Bundler:
92
+
93
+ ```ruby
94
+ gem 'stripe-opal'
95
+ ```
96
+
97
+ ## License
98
+
99
+ (The MIT License)
100
+
101
+ Copyright (C) 2015 by Rick Carlino
102
+
103
+ Permission is hereby granted, free of charge, to any person obtaining a copy
104
+ of this software and associated documentation files (the "Software"), to deal
105
+ in the Software without restriction, including without limitation the rights
106
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
107
+ copies of the Software, and to permit persons to whom the Software is
108
+ furnished to do so, subject to the following conditions:
109
+
110
+ The above copyright notice and this permission notice shall be included in
111
+ all copies or substantial portions of the Software.
112
+
113
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
114
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
115
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
116
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
117
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
118
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
119
+ THE SOFTWARE.
120
+
data/Rakefile ADDED
File without changes
data/config.ru ADDED
@@ -0,0 +1,13 @@
1
+ require 'bundler'
2
+ Bundler.require
3
+
4
+ require 'opal-rspec'
5
+ Opal.append_path File.expand_path('../spec', __FILE__)
6
+
7
+ run Opal::Server.new { |s|
8
+ s.main = 'opal/rspec/sprockets_runner'
9
+ s.append_path 'spec'
10
+ s.debug = false
11
+ s.index_path = 'spec/index.html.erb'
12
+ }
13
+
@@ -0,0 +1,8 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ </head>
5
+ <body>
6
+ <%= javascript_include_tag @server.main %>
7
+ </body>
8
+ </html>
@@ -0,0 +1,9 @@
1
+ require 'opal-rspec'
2
+ require 'stripe-opal'
3
+
4
+ module SomeHelpers
5
+ end
6
+
7
+ RSpec.configure do |config|
8
+ config.include SomeHelpers
9
+ end
@@ -0,0 +1,9 @@
1
+ require "spec_helper"
2
+
3
+ describe StripOpal::Card do
4
+ let(:four) { 4 }
5
+
6
+ describe ".placeholder" do
7
+ it 'equals four' { expect(2 + 2).to eq(four) }
8
+ end
9
+ end
@@ -0,0 +1,20 @@
1
+ require_relative 'lib/stripe-opal'
2
+
3
+ Gem::Specification.new do |s|
4
+ s.name = 'stripe-opal'
5
+ s.version = StripeOpal::VERSION
6
+ s.author = 'Rick Carlino'
7
+ s.email = 'rick@datamelon.io'
8
+ s.homepage = 'https://github.com/DataMelon/stripe-opal'
9
+ s.summary = 'Opal access to Stripe.js'
10
+ s.description = 'Wrapper around stripe.js to make Opal payments easier'
11
+
12
+ s.files = `git ls-files`.split("\n")
13
+ s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
14
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
15
+ s.require_paths = ['lib']
16
+
17
+ s.add_runtime_dependency 'opal', '>= 0.8.0'
18
+ s.add_development_dependency 'opal-rspec', '~> 0.4.0'
19
+ s.add_development_dependency 'rake'
20
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe-opal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rick Carlino
@@ -57,7 +57,17 @@ email: rick@datamelon.io
57
57
  executables: []
58
58
  extensions: []
59
59
  extra_rdoc_files: []
60
- files: []
60
+ files:
61
+ - ".gitignore"
62
+ - Gemfile
63
+ - LICENSE
64
+ - README.md
65
+ - Rakefile
66
+ - config.ru
67
+ - spec/index.html.erb
68
+ - spec/spec_helper.rb
69
+ - spec/stripe_opal_card_spec.rb
70
+ - stripe-opal.gemspec
61
71
  homepage: https://github.com/DataMelon/stripe-opal
62
72
  licenses: []
63
73
  metadata: {}