fraudpointer-client 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +8 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile +4 -0
- data/Guardfile +17 -0
- data/LICENSE +20 -0
- data/README.md +55 -0
- data/Rakefile +1 -0
- data/fixtures/vcr_cassettes/create_assessment_session.yml +36 -0
- data/fraudpointer-client.gemspec +48 -0
- data/lib/fraudpointer/assessment_session.rb +5 -0
- data/lib/fraudpointer/client/config.rb +16 -0
- data/lib/fraudpointer/client/version.rb +5 -0
- data/lib/fraudpointer/resource.rb +19 -0
- data/lib/fraudpointer-client.rb +11 -0
- data/spec/assessment_session_spec.rb +19 -0
- data/spec/spec_helper.rb +30 -0
- metadata +240 -0
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :bundler do
|
5
|
+
watch('Gemfile')
|
6
|
+
watch(/^.+\.gemspec/)
|
7
|
+
end
|
8
|
+
|
9
|
+
guard 'rspec', :cli => '--color --tag ~integration --tag ~pending', :version => 2 do
|
10
|
+
# Rails example
|
11
|
+
watch(%r{^spec/.+_spec\.rb$})
|
12
|
+
watch(%r{^lib/fraudpointer/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
+
watch(%r{^fixtures/(.+)}) { "spec" }
|
14
|
+
watch('lib/fraudpointer-client.rb') { "spec" }
|
15
|
+
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
|
16
|
+
watch('spec/spec_helper.rb') { "spec" }
|
17
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyrignt (c) 2011 Fraudpointer Ltd.
|
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,55 @@
|
|
1
|
+
# Fraudpointer REST API ruby client
|
2
|
+
|
3
|
+
Official ruby client for the Fraudpointer REST API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
### Bundler
|
8
|
+
|
9
|
+
Add on your Gemfile :
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'fraudpointer-client'
|
13
|
+
```
|
14
|
+
|
15
|
+
### By hand
|
16
|
+
|
17
|
+
On the console :
|
18
|
+
|
19
|
+
```bash
|
20
|
+
gem install fraudpointer-client
|
21
|
+
```
|
22
|
+
|
23
|
+
On your code :
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'fraudpointer-client'
|
27
|
+
```
|
28
|
+
|
29
|
+
## Usage
|
30
|
+
|
31
|
+
Create your [free Fraudpointer account](http://www.fraudpointer.com/)
|
32
|
+
and see the [official documentation](http://documentation.fraudpointer.com/)!
|
33
|
+
|
34
|
+
## Note on Patches/Pull Requests
|
35
|
+
|
36
|
+
* Fork the project.
|
37
|
+
* Make your feature addition or bug fix.
|
38
|
+
* Add tests for it. This is important so I don't break it in a
|
39
|
+
future version unintentionally (not really...).
|
40
|
+
* Commit, do not mess with gemspec, version, or history.
|
41
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
42
|
+
* Send a pull request. Bonus points for topic branches.
|
43
|
+
|
44
|
+
## Author(s)
|
45
|
+
|
46
|
+
* [Nikos Dimitrakopoulos](http://github.com/nikosd)
|
47
|
+
|
48
|
+
## Copyright
|
49
|
+
|
50
|
+
* Copyrignt (c) 2011 [Fraudpointer.com](http://www.fraudpointer.com)
|
51
|
+
|
52
|
+
## License
|
53
|
+
|
54
|
+
Fraudpointer Ruby client is released under the MIT license.
|
55
|
+
See [LICENSE](/fraudpointer/fraudpointer-client-rb/blob/master/LICENSE) for more details.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,36 @@
|
|
1
|
+
---
|
2
|
+
- !ruby/struct:VCR::HTTPInteraction
|
3
|
+
request: !ruby/struct:VCR::Request
|
4
|
+
method: :post
|
5
|
+
uri: https://production.fraudpointer.com:443/api/assessment_sessions.json?key=API_KEY
|
6
|
+
body: ! '{"assessment_session":{}}'
|
7
|
+
headers:
|
8
|
+
content-type:
|
9
|
+
- application/json
|
10
|
+
response: !ruby/struct:VCR::Response
|
11
|
+
status: !ruby/struct:VCR::ResponseStatus
|
12
|
+
code: 201
|
13
|
+
message: Created
|
14
|
+
headers:
|
15
|
+
date:
|
16
|
+
- Tue, 24 Jan 2012 13:09:58 GMT
|
17
|
+
server:
|
18
|
+
- Apache/2.2.19 (Debian)
|
19
|
+
x-powered-by:
|
20
|
+
- Phusion Passenger (mod_rails/mod_rack) 3.0.11
|
21
|
+
cache-control:
|
22
|
+
- no-cache
|
23
|
+
x-ua-compatible:
|
24
|
+
- IE=Edge,chrome=1
|
25
|
+
x-runtime:
|
26
|
+
- '0.123472'
|
27
|
+
location:
|
28
|
+
- https://production.fraudpointer.com/api/assessment_sessions/1555077
|
29
|
+
status:
|
30
|
+
- '201'
|
31
|
+
content-length:
|
32
|
+
- '37'
|
33
|
+
content-type:
|
34
|
+
- application/json; charset=utf-8
|
35
|
+
body: ! '{"assessment_session":{"id":1555077}}'
|
36
|
+
http_version: '1.1'
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "fraudpointer/client/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "fraudpointer-client"
|
7
|
+
s.version = Fraudpointer::Client::VERSION
|
8
|
+
s.authors = ["Nikos Dimitrakopoulos"]
|
9
|
+
s.email = ["n.dimitrakopoulos@fraudpointer.com"]
|
10
|
+
s.homepage = "http://www.fraudpointer.com"
|
11
|
+
s.summary = %q{Client library for accessing Fraudpointer REST API}
|
12
|
+
s.description = %q{Client library for accessing Fraudpointer REST API}
|
13
|
+
|
14
|
+
s.rubyforge_project = "fraudpointer-client"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# Development
|
22
|
+
s.add_development_dependency 'rake'
|
23
|
+
s.add_development_dependency 'mocha'
|
24
|
+
s.add_development_dependency 'webmock'
|
25
|
+
s.add_development_dependency 'vcr'
|
26
|
+
s.add_development_dependency 'rspec'
|
27
|
+
s.add_development_dependency 'guard'
|
28
|
+
s.add_development_dependency 'guard-rspec'
|
29
|
+
s.add_development_dependency 'guard-bundler'
|
30
|
+
s.add_development_dependency 'simplecov'
|
31
|
+
|
32
|
+
if RbConfig::CONFIG['target_os'] =~ /darwin/i
|
33
|
+
s.add_development_dependency 'rb-fsevent'
|
34
|
+
s.add_development_dependency 'growl'
|
35
|
+
elsif RbConfig::CONFIG['target_os'] =~ /linux/i
|
36
|
+
s.add_development_dependency 'rb-inotify'
|
37
|
+
s.add_development_dependency 'libnotify'
|
38
|
+
end
|
39
|
+
|
40
|
+
# Documentation
|
41
|
+
s.add_development_dependency 'yard'
|
42
|
+
s.add_development_dependency 'redcarpet'
|
43
|
+
s.add_development_dependency 'github-markup'
|
44
|
+
|
45
|
+
# Runtime
|
46
|
+
s.add_runtime_dependency 'activesupport'
|
47
|
+
s.add_runtime_dependency 'activeresource'
|
48
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Fraudpointer
|
2
|
+
class Resource < ActiveResource::Base
|
3
|
+
self.site = Client::SITE
|
4
|
+
|
5
|
+
def create
|
6
|
+
connection.post(collection_path, encode, self.class.headers).tap do |response|
|
7
|
+
self.id = id_from_response(response)
|
8
|
+
load_attributes_from_response(response)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
class << self
|
13
|
+
def collection_path(prefix_options = {}, query_options = nil)
|
14
|
+
super(prefix_options, (query_options || {}).merge(:key => Client.key))
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Fraudpointer
|
4
|
+
describe AssessmentSession do
|
5
|
+
before { Client.key = "API_KEY" }
|
6
|
+
|
7
|
+
describe '.create' do
|
8
|
+
subject {
|
9
|
+
VCR.use_cassette('create_assessment_session') do
|
10
|
+
AssessmentSession.create
|
11
|
+
end
|
12
|
+
}
|
13
|
+
|
14
|
+
it { should_not be_nil }
|
15
|
+
it { should be_kind_of(AssessmentSession) }
|
16
|
+
its(:id) { should == 1555077 }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'simplecov'
|
3
|
+
|
4
|
+
SimpleCov.start
|
5
|
+
|
6
|
+
# Set up gems listed in the Gemfile.
|
7
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
8
|
+
require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
|
9
|
+
|
10
|
+
require 'fraudpointer-client'
|
11
|
+
|
12
|
+
require 'mocha'
|
13
|
+
|
14
|
+
# XXX : This is a hack and it's needed because webmock/rspec and teamcity conflict!
|
15
|
+
# See https://github.com/bblimke/webmock/commit/9d255f118a6a39d297856fa83302aca1577b2c03#commitcomment-789795
|
16
|
+
# and https://github.com/bblimke/webmock/issues/64#issuecomment-3121086.
|
17
|
+
require 'rspec/expectations'
|
18
|
+
require 'webmock/rspec'
|
19
|
+
require 'vcr'
|
20
|
+
|
21
|
+
# VCR Setup
|
22
|
+
VCR.config do |c|
|
23
|
+
c.cassette_library_dir = File.expand_path('../../fixtures/vcr_cassettes', __FILE__)
|
24
|
+
c.stub_with :webmock
|
25
|
+
c.allow_http_connections_when_no_cassette = false
|
26
|
+
end
|
27
|
+
|
28
|
+
RSpec.configure do |config|
|
29
|
+
config.mock_framework = :mocha
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,240 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: fraudpointer-client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Nikos Dimitrakopoulos
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-24 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &2151934440 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :development
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2151934440
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: mocha
|
27
|
+
requirement: &2151933520 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :development
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2151933520
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: webmock
|
38
|
+
requirement: &2151932500 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '0'
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2151932500
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: vcr
|
49
|
+
requirement: &2151929920 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2151929920
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rspec
|
60
|
+
requirement: &2151929240 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2151929240
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard
|
71
|
+
requirement: &2151928520 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2151928520
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: guard-rspec
|
82
|
+
requirement: &2151941360 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2151941360
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: guard-bundler
|
93
|
+
requirement: &2151940040 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2151940040
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: simplecov
|
104
|
+
requirement: &2151938400 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2151938400
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: rb-fsevent
|
115
|
+
requirement: &2151937640 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *2151937640
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: growl
|
126
|
+
requirement: &2151936780 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *2151936780
|
135
|
+
- !ruby/object:Gem::Dependency
|
136
|
+
name: yard
|
137
|
+
requirement: &2152118740 !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
type: :development
|
144
|
+
prerelease: false
|
145
|
+
version_requirements: *2152118740
|
146
|
+
- !ruby/object:Gem::Dependency
|
147
|
+
name: redcarpet
|
148
|
+
requirement: &2152115180 !ruby/object:Gem::Requirement
|
149
|
+
none: false
|
150
|
+
requirements:
|
151
|
+
- - ! '>='
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
type: :development
|
155
|
+
prerelease: false
|
156
|
+
version_requirements: *2152115180
|
157
|
+
- !ruby/object:Gem::Dependency
|
158
|
+
name: github-markup
|
159
|
+
requirement: &2152113160 !ruby/object:Gem::Requirement
|
160
|
+
none: false
|
161
|
+
requirements:
|
162
|
+
- - ! '>='
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: '0'
|
165
|
+
type: :development
|
166
|
+
prerelease: false
|
167
|
+
version_requirements: *2152113160
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: activesupport
|
170
|
+
requirement: &2152112040 !ruby/object:Gem::Requirement
|
171
|
+
none: false
|
172
|
+
requirements:
|
173
|
+
- - ! '>='
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: '0'
|
176
|
+
type: :runtime
|
177
|
+
prerelease: false
|
178
|
+
version_requirements: *2152112040
|
179
|
+
- !ruby/object:Gem::Dependency
|
180
|
+
name: activeresource
|
181
|
+
requirement: &2152124720 !ruby/object:Gem::Requirement
|
182
|
+
none: false
|
183
|
+
requirements:
|
184
|
+
- - ! '>='
|
185
|
+
- !ruby/object:Gem::Version
|
186
|
+
version: '0'
|
187
|
+
type: :runtime
|
188
|
+
prerelease: false
|
189
|
+
version_requirements: *2152124720
|
190
|
+
description: Client library for accessing Fraudpointer REST API
|
191
|
+
email:
|
192
|
+
- n.dimitrakopoulos@fraudpointer.com
|
193
|
+
executables: []
|
194
|
+
extensions: []
|
195
|
+
extra_rdoc_files: []
|
196
|
+
files:
|
197
|
+
- .gitignore
|
198
|
+
- CHANGELOG.md
|
199
|
+
- Gemfile
|
200
|
+
- Guardfile
|
201
|
+
- LICENSE
|
202
|
+
- README.md
|
203
|
+
- Rakefile
|
204
|
+
- fixtures/vcr_cassettes/create_assessment_session.yml
|
205
|
+
- fraudpointer-client.gemspec
|
206
|
+
- lib/fraudpointer-client.rb
|
207
|
+
- lib/fraudpointer/assessment_session.rb
|
208
|
+
- lib/fraudpointer/client/config.rb
|
209
|
+
- lib/fraudpointer/client/version.rb
|
210
|
+
- lib/fraudpointer/resource.rb
|
211
|
+
- spec/assessment_session_spec.rb
|
212
|
+
- spec/spec_helper.rb
|
213
|
+
homepage: http://www.fraudpointer.com
|
214
|
+
licenses: []
|
215
|
+
post_install_message:
|
216
|
+
rdoc_options: []
|
217
|
+
require_paths:
|
218
|
+
- lib
|
219
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
220
|
+
none: false
|
221
|
+
requirements:
|
222
|
+
- - ! '>='
|
223
|
+
- !ruby/object:Gem::Version
|
224
|
+
version: '0'
|
225
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
226
|
+
none: false
|
227
|
+
requirements:
|
228
|
+
- - ! '>='
|
229
|
+
- !ruby/object:Gem::Version
|
230
|
+
version: '0'
|
231
|
+
requirements: []
|
232
|
+
rubyforge_project: fraudpointer-client
|
233
|
+
rubygems_version: 1.8.10
|
234
|
+
signing_key:
|
235
|
+
specification_version: 3
|
236
|
+
summary: Client library for accessing Fraudpointer REST API
|
237
|
+
test_files:
|
238
|
+
- spec/assessment_session_spec.rb
|
239
|
+
- spec/spec_helper.rb
|
240
|
+
has_rdoc:
|