subuno-ruby-api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +4 -0
- data/Gemfile +4 -0
- data/MIT-LICENSE +20 -0
- data/README.md +30 -0
- data/Rakefile +1 -0
- data/examples/example.rb +48 -0
- data/lib/subuno-ruby-api.rb +29 -0
- data/lib/subuno-ruby-api/version.rb +7 -0
- data/subuno-ruby-api.gemspec +23 -0
- metadata +70 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2011 Dale Neufeld
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# SubunoRubyAPI
|
2
|
+
|
3
|
+
A Ruby library for interacting with Subuno fraud screening API.
|
4
|
+
|
5
|
+
[Subuno](http://www.subuno.com)
|
6
|
+
[Subuno API](http://www.subuno.com/developers.html)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
### From Git
|
11
|
+
|
12
|
+
You can check out the latest source from git:
|
13
|
+
|
14
|
+
git clone git://github.com/dneufeld/subuno-ruby-api.git
|
15
|
+
|
16
|
+
## Usage Example
|
17
|
+
|
18
|
+
see examples/example.rb
|
19
|
+
|
20
|
+
Check out the [Subuno API docs](http://www.subuno.com/developers.html) for more information on what parameters are available.
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork the [official repository](https://github.com/dneufeld/subuno-ruby-api).
|
25
|
+
2. Make your changes in a topic branch.
|
26
|
+
3. Send a pull request.
|
27
|
+
|
28
|
+
Notes:
|
29
|
+
|
30
|
+
* Please don't update the Gem version.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/examples/example.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'subuno-ruby-api'
|
3
|
+
|
4
|
+
#set your API key
|
5
|
+
SubunoRubyAPI.apikey = "ABCDEFGHIJKL"
|
6
|
+
|
7
|
+
#perform Subuno fraud lookup
|
8
|
+
result = SubunoRubyAPI.lookup(
|
9
|
+
data = {
|
10
|
+
:t_id => "7d3n89wn" ,
|
11
|
+
:ip_addr => "24.24.24.24",
|
12
|
+
:customer_name => "John Doe",
|
13
|
+
:phone => "212-456-7890",
|
14
|
+
:email => "john.doe@domain.com",
|
15
|
+
:company => "Doe LLC",
|
16
|
+
:price => "50.0",
|
17
|
+
:bin => "480128",
|
18
|
+
|
19
|
+
:bill_street1 => "12 East 71th St",
|
20
|
+
:bill_street2 => "#12",
|
21
|
+
:bill_city => "New York",
|
22
|
+
:bill_state => "NY",
|
23
|
+
:bill_country => "US" ,
|
24
|
+
:bill_zip => "10021",
|
25
|
+
|
26
|
+
:ship_street1 => "12 East 71th St",
|
27
|
+
:ship_street2 => "#12",
|
28
|
+
:ship_city => "New York",
|
29
|
+
:ship_state => "NY",
|
30
|
+
:ship_country => "US",
|
31
|
+
:ship_zip => "10021",
|
32
|
+
|
33
|
+
:avs_response => "X",
|
34
|
+
:ccv_response => "M",
|
35
|
+
# :custom1 => "first custom value",
|
36
|
+
# :custom2 => "second custom value",
|
37
|
+
# :custom3 => "third custom value",
|
38
|
+
:issuer_phone => "18667750556",
|
39
|
+
:source => "affiliate_code_here",
|
40
|
+
}
|
41
|
+
)
|
42
|
+
|
43
|
+
#result is a ruby hash of keys/value pairs with data returned by api.
|
44
|
+
puts result
|
45
|
+
puts "action is #{result['action']}"
|
46
|
+
puts "ref_code is #{result['ref_code']}"
|
47
|
+
puts "t_id is #{result['t_id']}"
|
48
|
+
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "httparty"
|
2
|
+
|
3
|
+
module SubunoRubyAPI
|
4
|
+
class Error < StandardError; end
|
5
|
+
|
6
|
+
include HTTParty
|
7
|
+
base_uri 'https://api.subuno.com'
|
8
|
+
class << self
|
9
|
+
attr_accessor :apikey
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.parse(response)
|
13
|
+
return response.parsed_response
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.lookup(options={}, apikey=nil)
|
17
|
+
validate
|
18
|
+
options.merge!(:apikey => apikey || SubunoRubyAPI.apikey)
|
19
|
+
response = get('/v1', :query => options)
|
20
|
+
|
21
|
+
parse(response)
|
22
|
+
end
|
23
|
+
|
24
|
+
protected
|
25
|
+
def self.validate
|
26
|
+
raise ArgumentError, 'api key required' if @apikey.nil?
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "subuno-ruby-api/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "subuno-ruby-api"
|
7
|
+
s.version = Subuno::Ruby::Api::VERSION
|
8
|
+
s.authors = ["dneufeld"]
|
9
|
+
s.email = ["dale.neufeld@shopify.com"]
|
10
|
+
s.homepage = ""
|
11
|
+
s.summary = %q{Ruby API library for Subuno API}
|
12
|
+
s.description = %q{Provides integration with the Subuno fraud screening API}
|
13
|
+
|
14
|
+
s.rubyforge_project = "subuno-ruby-api"
|
15
|
+
|
16
|
+
s.add_runtime_dependency("httparty")
|
17
|
+
|
18
|
+
s.files = `git ls-files`.split("\n")
|
19
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
20
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
21
|
+
s.require_paths = ["lib"]
|
22
|
+
|
23
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: subuno-ruby-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- dneufeld
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-08-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
description: Provides integration with the Subuno fraud screening API
|
31
|
+
email:
|
32
|
+
- dale.neufeld@shopify.com
|
33
|
+
executables: []
|
34
|
+
extensions: []
|
35
|
+
extra_rdoc_files: []
|
36
|
+
files:
|
37
|
+
- .gitignore
|
38
|
+
- Gemfile
|
39
|
+
- MIT-LICENSE
|
40
|
+
- README.md
|
41
|
+
- Rakefile
|
42
|
+
- examples/example.rb
|
43
|
+
- lib/subuno-ruby-api.rb
|
44
|
+
- lib/subuno-ruby-api/version.rb
|
45
|
+
- subuno-ruby-api.gemspec
|
46
|
+
homepage: ''
|
47
|
+
licenses: []
|
48
|
+
post_install_message:
|
49
|
+
rdoc_options: []
|
50
|
+
require_paths:
|
51
|
+
- lib
|
52
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
none: false
|
54
|
+
requirements:
|
55
|
+
- - ! '>='
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '0'
|
58
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
64
|
+
requirements: []
|
65
|
+
rubyforge_project: subuno-ruby-api
|
66
|
+
rubygems_version: 1.8.23
|
67
|
+
signing_key:
|
68
|
+
specification_version: 3
|
69
|
+
summary: Ruby API library for Subuno API
|
70
|
+
test_files: []
|