spreedly-core-ruby 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,11 +1,12 @@
1
1
  SpreedlyCore
2
2
  ======
3
-
4
- spreedly-core-ruby is a Ruby library for accessing the [Spreedly Core API](https://spreedlycore.com/). Spreedly Core is a Software-as-a-Service billing solution that serves two major functions for companies and developers.
3
+ spreedly-core-ruby is a Ruby library for accessing the [Spreedly Core API](https://spreedlycore.com/). Spreedly Core is a Software-as-a-Service billing solution that serves two major functions for companies and developers.
5
4
 
6
5
  * First, it removes your [PCI Compliance](https://www.pcisecuritystandards.org/) requirement by pushing the card data handling and storage outside of your application. This is possible by having your customers POST their credit card info to the Spreedly Core service while embedding a transparent redirect URL back to your application (see "Submit payment form" on [the quick start guide](https://spreedlycore.com/manual/quickstart)).
7
6
  * Second, it removes any possibility of your gateway locking you in by owning your customer billing data (yes, this happens). By allowing you to charge any card against whatever gateways you as a company have signed up for, you retain all of your customer data and can switch between gateways as you please. Also, expanding internationally won't require an additional technical integration with yet another gateway.
8
7
 
8
+ Credit where credit is due: our friends over at [403 Labs](http://www.403labs.com/) carried most of the weight in cutting the initial version of this gem, and we can't thank them enough for their work.
9
+
9
10
  Quickstart
10
11
  ----------
11
12
  Head over to the [Spreedly Core Website](https://www.spreedlycore.com) to sign up for an account. It's free to get started and play with test gateways/transactions using our specified test card data.
@@ -172,22 +173,27 @@ Additional Field Validation
172
173
  ----------
173
174
  The Spreely Core API provides validation of the credit card number, security code, and
174
175
  first and last name. In most cases this is enough; however, sometimes you may want to
175
- enforce the full billing information as well. This can be accomplished via the following:
176
+ enforce the full billing information as well. The following example illustrates how this can be accomplished.
176
177
 
177
178
  SpreedlyCore.configure
178
179
  SpreedlyCore::PaymentMethod.additional_required_cc_fields :address1, :city, :state, :zip
180
+
179
181
  master_card_data = SpreedlyCore::TestHelper.cc_data(:master)
180
182
  token = SpreedlyCore::PaymentMethod.create_test_token(master_card_data)
183
+
181
184
  payment_method = SpreedlyCore::PaymentMethod.find(token)
182
185
  payment_method.valid? # false
183
186
  payment_method.errors # ["Address1 can't be blank", "City can't be blank", "State can't be blank", "Zip can't be blank"]
187
+
184
188
  master_card_data = SpreedlyCore::TestHelper.cc_data(:master, :credit_card => {:address1 => "742 Evergreen Terrace", :city => "Springfield", :state => "IL", 62701})
189
+ token = SpreedlyCore::PaymentMethod.create_test_token(master_card_data)
190
+
185
191
  payment_method = SpreedlyCore::PaymentMethod.find(token)
186
192
  payment_method.valid? # returns true
187
193
  payment_method.errors # []
188
194
 
189
195
 
190
- Configuring SpreedlyCore for use in production (Rails example)
196
+ Configuring SpreedlyCore for Use in Production (Rails example)
191
197
  ----------
192
198
  When you're ready for primetime, you'll need to complete a couple more steps to start processing real transactions.
193
199
 
@@ -196,18 +202,26 @@ When you're ready for primetime, you'll need to complete a couple more steps to
196
202
 
197
203
  For this example, I will be using an Authorize.net account that only has a login and password credential.
198
204
 
199
- authorize_credentials = {:login => 'my_authorize_login', :password => 'my_authorize_password'}
200
205
  SpreedlyCore.configure
201
- gateway = SpreedlyCore::Gateway.create(authorize_credentials)
202
- puts "Authorize.net gateway token is #{gateway.token}"
206
+
207
+ gateway = SpreedlyCore::Gateway.create(:login => 'my_authorize_login', :password => 'my_authorize_password', :gateway_type => 'authorize_net')
203
208
  gateway.use!
204
209
 
205
- For most users, you will start off using only 1 gateway token, and as such can configure an additional 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.
210
+ puts "Authorize.net gateway token is #{gateway.token}"
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.
206
213
 
207
214
  # create an initializer at config/initializers/spreedly_core.rb
208
215
  # values already set for ENV['SPREEDLYCORE_API_LOGIN'], ENV['SPREEDLYCORE_API_SECRET'], and ENV['SPREEDLYCORE_GATEWAY_TOKEN']
209
216
  SpreedlyCore.configure
210
217
 
218
+ If you wish to require additional credit card fields, the initializer is the best place to set this up.
219
+
220
+ SpreedlyCore.configure
221
+ SpreedlyCore::PaymentMethod.additional_required_cc_fields :address1, :city, :state, :zip
222
+
223
+ Using Multiple Gateways
224
+ ------------
211
225
  For those using multiple gateway tokens, there is a class variable that holds the active gateway token. Before running any sort of transaction against a payment method, you'll need to set the gateway token that you wish to charge against.
212
226
 
213
227
  SpreedlyCore.configure
@@ -218,19 +232,30 @@ For those using multiple gateway tokens, there is a class variable that holds th
218
232
  SpreedlyCore.gateway_token(authorize_gateway_token)
219
233
  SpreedlyCore::PaymentMethod.find(pm_token).purchase(2885)
220
234
 
221
- If you wish to require additional credit card fields, the initializer is the best place to set this up.
235
+ SpreedlyCore.gateway_token(braintree_gateway_token)
236
+ SpreedlyCore::PaymentMethod.find(pm_token).credit(150)
237
+
238
+ Creating Payment Types Programatically
239
+ ------------
240
+ For those using multiple gateway tokens, there is a class variable that holds the active gateway token. Before running any sort of transaction against a payment method, you'll need to set the gateway token that you wish to charge against.
222
241
 
223
242
  SpreedlyCore.configure
224
- SpreedlyCore::PaymentMethod.additional_required_cc_fields :address1, :city, :state, :zip
243
+
244
+ SpreedlyCore.gateway_token(paypal_gateway_token)
245
+ SpreedlyCore::PaymentMethod.find(pm_token).purchase(550)
246
+
247
+ SpreedlyCore.gateway_token(authorize_gateway_token)
248
+ SpreedlyCore::PaymentMethod.find(pm_token).purchase(2885)
249
+
250
+ SpreedlyCore.gateway_token(braintree_gateway_token)
251
+ SpreedlyCore::PaymentMethod.find(pm_token).credit(150)
225
252
 
226
253
  Contributing
227
254
  ------------
228
-
229
- Once you've made your commits:
230
-
231
- 1. [Fork](http://help.github.com/forking/) SpreedlyCore
232
- 2. Create a topic branch - `git checkout -b my_branch`
255
+ 1. [Fork](http://help.github.com/forking/) spreedly-core-ruby
256
+ 2. Create a topic branch - `git checkout -b my_branch
257
+ 3. Make your changes on your topic branch.
258
+ 4. DO NOT bump the version number, or put it in a separate commit that I can ignore.
233
259
  3. Push to your branch - `git push origin my_branch`
234
260
  4. Create a [Pull Request](http://help.github.com/pull-requests/) from your branch
235
- 5. Profit!
236
261
 
@@ -1,4 +1,4 @@
1
1
  module SpreedlyCore
2
- Version = VERSION = "0.1.3"
2
+ Version = VERSION = "0.1.4"
3
3
  ApiVersion = API_VERSION = "v1"
4
4
  end
@@ -6,6 +6,7 @@ require 'active_support/core_ext/hash/conversions'
6
6
  require 'spreedly-core-ruby/base'
7
7
  require 'spreedly-core-ruby/payment_method'
8
8
  require 'spreedly-core-ruby/gateway'
9
+ require 'spreedly-core-ruby/test_extensions'
9
10
  require 'spreedly-core-ruby/test_gateway'
10
11
  require 'spreedly-core-ruby/transactions'
11
12
  require 'active_support/core_ext/hash/conversions'
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.3
4
+ version: 0.1.4
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: &70198459726880 !ruby/object:Gem::Requirement
17
+ requirement: &70226775420580 !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: *70198459726880
25
+ version_requirements: *70226775420580
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: activesupport
28
- requirement: &70198459725600 !ruby/object:Gem::Requirement
28
+ requirement: &70226775420040 !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: *70198459725600
36
+ version_requirements: *70226775420040
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: builder
39
- requirement: &70198459724560 !ruby/object:Gem::Requirement
39
+ requirement: &70226775419660 !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: *70198459724560
47
+ version_requirements: *70226775419660
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: ruby-debug19
50
- requirement: &70198459723100 !ruby/object:Gem::Requirement
50
+ requirement: &70226775419000 !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: *70198459723100
58
+ version_requirements: *70226775419000
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rake
61
- requirement: &70198459721160 !ruby/object:Gem::Requirement
61
+ requirement: &70226775418400 !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: *70198459721160
69
+ version_requirements: *70226775418400
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: webmock
72
- requirement: &70198459719780 !ruby/object:Gem::Requirement
72
+ requirement: &70226775417800 !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: *70198459719780
80
+ version_requirements: *70226775417800
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.