spreedly-core-ruby 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +25 -13
- data/lib/spreedly-core-ruby.rb +4 -0
- data/lib/spreedly-core-ruby/version.rb +1 -1
- metadata +13 -13
data/README.md
CHANGED
@@ -209,7 +209,7 @@ For this example, I will be using an Authorize.net account that only has a login
|
|
209
209
|
|
210
210
|
puts "Authorize.net gateway token is #{gateway.token}"
|
211
211
|
|
212
|
-
For most users, you will start off using only one gateway token, and as such can configure it as an environment variable to hold your gateway token. In addition to the previous environment variables, the SpreedlyCore.configure method will also look for a SPREEDLYCORE_GATEWAY_TOKEN environment value.
|
212
|
+
For most users, you will start off using only one gateway token, and as such can configure it as an environment variable to hold your gateway token. In addition to the previous environment variables, the `SpreedlyCore.configure` method will also look for a SPREEDLYCORE_GATEWAY_TOKEN environment value.
|
213
213
|
|
214
214
|
# create an initializer at config/initializers/spreedly_core.rb
|
215
215
|
# values already set for ENV['SPREEDLYCORE_API_LOGIN'], ENV['SPREEDLYCORE_API_SECRET'], and ENV['SPREEDLYCORE_GATEWAY_TOKEN']
|
@@ -237,23 +237,35 @@ For those using multiple gateway tokens, there is a class variable that holds th
|
|
237
237
|
|
238
238
|
Creating Payment Types Programatically
|
239
239
|
------------
|
240
|
-
|
240
|
+
**Please note that this practice requires you to be PCI compliant!**
|
241
241
|
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
242
|
+
In special cases, you may want to create payment types programmatically and will not be using the transparent redirect functionality. This can be done using the `SpreedlyCore::PaymentMethod.create` method, and will behave as follows:
|
243
|
+
|
244
|
+
* Card validation is done in realtime, and a 422 Unprocessable will be returned if validation fails.
|
245
|
+
* Successful execution will return an AddPaymentMethodTransaction object (*not* a PaymentMethod object). Adding a payment method is wrapped in a transaction much like doing a purchase or authorize request is. The returned object will have the PaymentMethod object as a child.
|
246
|
+
* You still need to manually call `retain` on the payment method if you wish to retain the card.
|
247
|
+
|
248
|
+
The example below illustrates both a successful payment method creation, and how to handle one with errors.
|
249
|
+
|
250
|
+
SpreedlyCore.configure
|
251
|
+
|
252
|
+
pm_transaction = SpreedlyCore::PaymentMethod.create(:credit_card => good_card_hash)
|
253
|
+
pm_token = pm_transaction.payment_method.token
|
254
|
+
puts "Payment method token is #{pm_token}"
|
255
|
+
|
256
|
+
retain_transaction = pm_transaction.payment_method.retain
|
257
|
+
retain_transaction.succeeded? # true
|
258
|
+
|
259
|
+
begin
|
260
|
+
pm_transaction = SpreedlyCore::PaymentMethod.create(:credit_card => bad_card_hash)
|
261
|
+
rescue Exception => e
|
262
|
+
puts "Errors when submitting the card: #{e.errors.join(",")}"
|
263
|
+
end
|
252
264
|
|
253
265
|
Contributing
|
254
266
|
------------
|
255
267
|
1. [Fork](http://help.github.com/forking/) spreedly-core-ruby
|
256
|
-
2. Create a topic branch - `git checkout -b my_branch
|
268
|
+
2. Create a topic branch - `git checkout -b my_branch`
|
257
269
|
3. Make your changes on your topic branch.
|
258
270
|
4. DO NOT bump the version number, or put it in a separate commit that I can ignore.
|
259
271
|
3. Push to your branch - `git push origin my_branch`
|
data/lib/spreedly-core-ruby.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spreedly-core-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -14,7 +14,7 @@ date: 2012-03-21 00:00:00.000000000Z
|
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: httparty
|
17
|
-
requirement: &
|
17
|
+
requirement: &70270991883080 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - =
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.7.7
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *70270991883080
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &70270991882520 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: 3.0.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *70270991882520
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: builder
|
39
|
-
requirement: &
|
39
|
+
requirement: &70270991882080 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ! '>='
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *70270991882080
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: ruby-debug19
|
50
|
-
requirement: &
|
50
|
+
requirement: &70270991881440 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *70270991881440
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: rake
|
61
|
-
requirement: &
|
61
|
+
requirement: &70270991880840 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - =
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 0.8.7
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *70270991880840
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: webmock
|
72
|
-
requirement: &
|
72
|
+
requirement: &70270991880280 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ~>
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: 1.6.2
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *70270991880280
|
81
81
|
description: Spreedly Core is a cloud service that allows you to store credit cards
|
82
82
|
and run transactions against them, enabling you to accept payments on your website
|
83
83
|
while avoiding all liability and PCI compliance requirements.
|