fat_zebra 0.0.5 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +49 -10
- data/lib/fat_zebra/constants.rb +2 -1
- data/lib/fat_zebra/gateway.rb +5 -3
- data/lib/fat_zebra/version.rb +1 -1
- metadata +16 -16
data/README.markdown
CHANGED
@@ -1,19 +1,58 @@
|
|
1
1
|
Ruby API Library for Fat Zebra
|
2
2
|
==============================
|
3
3
|
|
4
|
-
|
4
|
+
Release 1.0.0 for API version 1.0
|
5
5
|
|
6
|
-
|
6
|
+
A Ruby client for the [Fat Zebra](https://www.fatzebra.com.au) Online Payment Gateway (for Australian Merchants)
|
7
7
|
|
8
|
-
|
9
|
-
|
10
|
-
4. Call the purchase() method on the gateway object.
|
11
|
-
5. Examine the result.
|
8
|
+
Dependencies
|
9
|
+
------------
|
12
10
|
|
13
|
-
|
11
|
+
* Ruby (tested on 1.9.2, 1.9.3)
|
12
|
+
* Rest Client
|
13
|
+
* JSON
|
14
14
|
|
15
|
-
|
15
|
+
Installing
|
16
|
+
----------
|
16
17
|
|
17
|
-
|
18
|
+
gem install fat_zebra
|
18
19
|
|
19
|
-
|
20
|
+
Or in a Rails App (or similar, with Bundler), in your Gemfile:
|
21
|
+
|
22
|
+
gem "fat_zebra"
|
23
|
+
|
24
|
+
Usage
|
25
|
+
-----
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
require 'fat_zebra'
|
29
|
+
|
30
|
+
gateway = FatZebra::Gateway.new("TEST", "TEST", "gateway.sandbox.fatzebra.com.au") # You can ommit the last parameter - by default it will use the Live Gateway
|
31
|
+
|
32
|
+
card_data = {
|
33
|
+
card_number: "5123456789012346",
|
34
|
+
card_holder: "Bill Simpson",
|
35
|
+
card_expiry: "05/2013",
|
36
|
+
ccv: "123"
|
37
|
+
}
|
38
|
+
response = gateway.purchase(10000, card_data, "ORDER-23, "203.99.87.4")
|
39
|
+
|
40
|
+
if response.successful? && response.result.successful
|
41
|
+
puts "Transaction ID: #{response.result.id}"
|
42
|
+
else
|
43
|
+
abort "Error in transaction: #{response.error_messages}"
|
44
|
+
end
|
45
|
+
```
|
46
|
+
|
47
|
+
Documentation
|
48
|
+
-------------
|
49
|
+
|
50
|
+
Full API reference can be found at http://docs.fatzebra.com.au
|
51
|
+
|
52
|
+
Support
|
53
|
+
-------
|
54
|
+
If you have any issue with the Fat Zebra Ruby Client please contact us at support@fatzebra.com.au and we will be more then happy to help out. Alternatively you may raise an issue in github.
|
55
|
+
|
56
|
+
Pull Requests
|
57
|
+
-------------
|
58
|
+
If you would like to contribute to the plugin please fork the project, make your changes within a feature branch and then submit a pull request. All pull requests will be reviewed as soon as possible and integrated into the main branch if deemed suitable.
|
data/lib/fat_zebra/constants.rb
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
GATEWAY_SERVER = "gateway.fatzebra.com.au"
|
1
|
+
GATEWAY_SERVER = "gateway.fatzebra.com.au"
|
2
|
+
API_VERSION = "1.0"
|
data/lib/fat_zebra/gateway.rb
CHANGED
@@ -2,13 +2,14 @@ module FatZebra
|
|
2
2
|
class Gateway
|
3
3
|
attr_accessor :username, :token, :gateway_server, :options
|
4
4
|
|
5
|
-
DEFAULT_OPTIONS = {:secure => true}
|
5
|
+
DEFAULT_OPTIONS = {:secure => true, :version => API_VERSION}
|
6
6
|
|
7
7
|
# Public: initializes a new gateway object
|
8
8
|
#
|
9
9
|
# username - merchants username
|
10
10
|
# token - merchants token for authentication
|
11
|
-
#
|
11
|
+
# gateway_server - the server for the gateway, defaults to 'gateway.fatzebra.com.au'
|
12
|
+
# options - the options for the gateway connection (e.g. secure, version etc)
|
12
13
|
#
|
13
14
|
# Returns a new FatZebra::Gateway instance
|
14
15
|
def initialize(username, token, gateway_server = GATEWAY_SERVER, options = {})
|
@@ -189,7 +190,8 @@ module FatZebra
|
|
189
190
|
when false
|
190
191
|
"http://"
|
191
192
|
end
|
192
|
-
|
193
|
+
version = options[:version]
|
194
|
+
url = "#{proto}#{self.gateway_server}/v#{version}/#{resource}"
|
193
195
|
unless data.nil?
|
194
196
|
url = url + "?"
|
195
197
|
data.each do |key, value|
|
data/lib/fat_zebra/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fat_zebra
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-04-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rspec
|
16
|
-
requirement: &
|
16
|
+
requirement: &70274955595520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70274955595520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake
|
27
|
-
requirement: &
|
27
|
+
requirement: &70274955594920 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70274955594920
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: yard
|
38
|
-
requirement: &
|
38
|
+
requirement: &70274955593760 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70274955593760
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: yard-tomdoc
|
49
|
-
requirement: &
|
49
|
+
requirement: &70274955593300 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70274955593300
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rest-client
|
60
|
-
requirement: &
|
60
|
+
requirement: &70274955592760 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70274955592760
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: json
|
71
|
-
requirement: &
|
71
|
+
requirement: &70274955496320 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,7 +76,7 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :runtime
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *70274955496320
|
80
80
|
description: Provides integration with the Fat Zebra internet payment gateway (www.fatzebra.com.au),
|
81
81
|
including purchase, refund, auth, capture and recurring billing functionality.
|
82
82
|
email:
|
@@ -119,7 +119,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
segments:
|
121
121
|
- 0
|
122
|
-
hash:
|
122
|
+
hash: -164626875595423267
|
123
123
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
124
124
|
none: false
|
125
125
|
requirements:
|
@@ -128,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
segments:
|
130
130
|
- 0
|
131
|
-
hash:
|
131
|
+
hash: -164626875595423267
|
132
132
|
requirements: []
|
133
133
|
rubyforge_project: fat_zebra
|
134
134
|
rubygems_version: 1.8.10
|