blockscore 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1dc8082c4d10d97829956d2072a2b60414efcd80
4
+ data.tar.gz: 3c8434efbaaeb92b45a1ed595b7016547636f454
5
+ SHA512:
6
+ metadata.gz: e54648a2081f0e6e255140e089779fcb1e5d4d68611127e0793f54f7489e88fd8f87e6cf98f2aa71ce530a2baf066e26a85ae1363478cb6cfa4b7c9dd17cf234
7
+ data.tar.gz: 61c267ffbabeaf245912e87420a51a4c63a0eb1c35288fcc35ccc63e61dac9e2350651fd5507d4e2dcb34a9d554c1870449a075e8b143b0d10ae74f21187f940
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,18 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ ruby '2.0.0'
7
+
8
+ gem "httparty"
9
+
10
+ # Add dependencies to develop your gem here.
11
+ # Include everything needed to run rake, tests, features, etc.
12
+ group :development do
13
+ gem "shoulda", ">= 0"
14
+ gem "rdoc", "~> 3.12"
15
+ gem "bundler", "~> 1.0"
16
+ gem "jeweler", "~> 2.0.1"
17
+ gem "simplecov", ">= 0"
18
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,85 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ activesupport (4.0.3)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ addressable (2.3.5)
11
+ atomic (1.1.14)
12
+ builder (3.2.2)
13
+ descendants_tracker (0.0.3)
14
+ docile (1.1.3)
15
+ faraday (0.9.0)
16
+ multipart-post (>= 1.2, < 3)
17
+ git (1.2.6)
18
+ github_api (0.11.3)
19
+ addressable (~> 2.3)
20
+ descendants_tracker (~> 0.0.1)
21
+ faraday (~> 0.8, < 0.10)
22
+ hashie (>= 1.2)
23
+ multi_json (>= 1.7.5, < 2.0)
24
+ nokogiri (~> 1.6.0)
25
+ oauth2
26
+ hashie (2.0.5)
27
+ highline (1.6.20)
28
+ httparty (0.12.0)
29
+ json (~> 1.8)
30
+ multi_xml (>= 0.5.2)
31
+ i18n (0.6.9)
32
+ jeweler (2.0.1)
33
+ builder
34
+ bundler (>= 1.0)
35
+ git (>= 1.2.5)
36
+ github_api
37
+ highline (>= 1.6.15)
38
+ nokogiri (>= 1.5.10)
39
+ rake
40
+ rdoc
41
+ json (1.8.1)
42
+ jwt (0.1.11)
43
+ multi_json (>= 1.5)
44
+ mini_portile (0.5.2)
45
+ minitest (4.7.5)
46
+ multi_json (1.8.4)
47
+ multi_xml (0.5.5)
48
+ multipart-post (2.0.0)
49
+ nokogiri (1.6.1)
50
+ mini_portile (~> 0.5.0)
51
+ oauth2 (0.9.3)
52
+ faraday (>= 0.8, < 0.10)
53
+ jwt (~> 0.1.8)
54
+ multi_json (~> 1.3)
55
+ multi_xml (~> 0.5)
56
+ rack (~> 1.2)
57
+ rack (1.5.2)
58
+ rake (10.1.1)
59
+ rdoc (3.12.2)
60
+ json (~> 1.4)
61
+ shoulda (3.5.0)
62
+ shoulda-context (~> 1.0, >= 1.0.1)
63
+ shoulda-matchers (>= 1.4.1, < 3.0)
64
+ shoulda-context (1.1.6)
65
+ shoulda-matchers (2.5.0)
66
+ activesupport (>= 3.0.0)
67
+ simplecov (0.8.2)
68
+ docile (~> 1.1.0)
69
+ multi_json
70
+ simplecov-html (~> 0.8.0)
71
+ simplecov-html (0.8.0)
72
+ thread_safe (0.1.3)
73
+ atomic
74
+ tzinfo (0.3.38)
75
+
76
+ PLATFORMS
77
+ ruby
78
+
79
+ DEPENDENCIES
80
+ bundler (~> 1.0)
81
+ httparty
82
+ jeweler (~> 2.0.1)
83
+ rdoc (~> 3.12)
84
+ shoulda
85
+ simplecov
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 BlockScore
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,121 @@
1
+ # blockscore-ruby
2
+
3
+ This is the official library for Ruby clients of the BlockScore API. [Click here to read the full documentation](https://manage.blockscore.com/docs).
4
+
5
+ ## Install
6
+
7
+ Via rubygems.org:
8
+
9
+ ```ruby
10
+ gem install blockscore
11
+ ```
12
+
13
+ If you are using rails, add the following to your `Gemfile`:
14
+
15
+ ```ruby
16
+ gem 'blockscore', '~> 1.0.0'
17
+ ```
18
+
19
+ ## Getting Started
20
+
21
+ ### Initializing BlockScore
22
+
23
+ ```ruby
24
+ @blockscore = BlockScore::Client("your-api-key", version = 2)
25
+ ```
26
+
27
+ ## Verifications
28
+
29
+ ### List all verifications
30
+
31
+ ```ruby
32
+ @blockscore.verifications
33
+ ```
34
+
35
+ ### View a verification by ID
36
+
37
+ ```ruby
38
+ @blockscore.verification("526781407e7b0ace47000001")
39
+ ```
40
+
41
+ ### Create a new verification
42
+
43
+ ```ruby
44
+ @blockscore.create_verification({
45
+ type: "us_citizen",
46
+ date_of_birth: "1993-08-23",
47
+ identification: {
48
+ ssn: "0000"
49
+ },
50
+ name: {
51
+ first: "Alain",
52
+ middle: nil,
53
+ last: "Meier"
54
+ },
55
+ address: {
56
+ street1: "1 Infinite Loop",
57
+ street2: nil,
58
+ city: "Cupertino",
59
+ state: "CA",
60
+ postal_code: "95014",
61
+ country: "US"
62
+ }
63
+ })
64
+ ```
65
+
66
+ ## Question Sets
67
+
68
+ ### Create a new question set
69
+
70
+ ```ruby
71
+ @blockscore.create_question_set({
72
+ verification_id: "53099a636274639ebb0e0000"
73
+ })
74
+ ```
75
+
76
+ ### Score a question set
77
+
78
+ ```ruby
79
+ @blockscore.score_question_set({
80
+ verification_id: "53099a636274639ebb0e0000",
81
+ question_set_id: "53099c5f6274639ebb7e0000",
82
+ answers: [
83
+ {
84
+ question_id: 1,
85
+ answer_id: 1
86
+ },
87
+ {
88
+ question_id: 2,
89
+ answer_id: 1
90
+ },
91
+ {
92
+ question_id: 3,
93
+ answer_id: 1
94
+ },
95
+ {
96
+ question_id: 4,
97
+ answer_id: 1
98
+ },
99
+ {
100
+ question_id: 5,
101
+ answer_id: 1
102
+ }
103
+ ]
104
+ })
105
+ ```
106
+
107
+ ## Contributing to BlockScore
108
+
109
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
110
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
111
+ * Fork the project.
112
+ * Start a feature/bugfix branch.
113
+ * Commit and push until you are happy with your contribution.
114
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
115
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
116
+
117
+ ## Copyright
118
+
119
+ Copyright (c) 2014 BlockScore. See LICENSE.txt for
120
+ further details.
121
+
data/Rakefile ADDED
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
17
+ gem.name = "blockscore"
18
+ gem.homepage = "http://github.com/blockscore/blockscore-ruby"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{A ruby client library for the BlockScore API.}
21
+ gem.description = %Q{A ruby client library for the BlockScore API.}
22
+ gem.email = "alain@blockscore.com"
23
+ gem.authors = ["Alain Meier"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ desc "Code coverage detail"
36
+ task :simplecov do
37
+ ENV['COVERAGE'] = "true"
38
+ Rake::Task['test'].execute
39
+ end
40
+
41
+ task :default => :test
42
+
43
+ require 'rdoc/task'
44
+ Rake::RDocTask.new do |rdoc|
45
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
46
+
47
+ rdoc.rdoc_dir = 'rdoc'
48
+ rdoc.title = "blockscore #{version}"
49
+ rdoc.rdoc_files.include('README*')
50
+ rdoc.rdoc_files.include('lib/**/*.rb')
51
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0
@@ -0,0 +1,21 @@
1
+ {
2
+ "settings":
3
+ {
4
+ "trim_automatic_white_space": true,
5
+ "translate_tabs_to_spaces": true,
6
+ "tab_size": 2
7
+ },
8
+
9
+ "folders":
10
+ [
11
+ {
12
+ "path": "./"
13
+ },
14
+ {
15
+ "path": "lib"
16
+ },
17
+ {
18
+ "path": "test"
19
+ }
20
+ ]
21
+ }
data/lib/blockscore.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "httparty"
2
+
3
+ Dir[File.dirname(__FILE__) + '/blockscore/*.rb'].each do |file|
4
+ require file
5
+ end
@@ -0,0 +1,52 @@
1
+ module BlockScore
2
+ class Client
3
+ include HTTParty
4
+
5
+ def initialize(api_key, version, options = {})
6
+ @api_key = api_key
7
+ @auth = { username: @api_key, password: "" }
8
+
9
+ options[:base_uri] ||= "https://api.blockscore.com"
10
+ options[:headers] = { 'Accept' => 'application/vnd.blockscore+json;version=' + version.to_s }
11
+
12
+ options.each do |k,v|
13
+ self.class.send k, v
14
+ end
15
+ end
16
+
17
+ def get_verifications
18
+ self.get '/verifications'
19
+ end
20
+
21
+ def get_verification(id)
22
+ self.get '/verifications/' + id.to_s
23
+ end
24
+
25
+ def create_verification(options = {})
26
+ self.post '/verifications/', options
27
+ end
28
+
29
+ # def get_question_set(id)
30
+ # self.get '/questions/' + id.to_s
31
+ # end
32
+
33
+ def create_question_set(options = {})
34
+ self.post '/questions/', options
35
+ end
36
+
37
+ def score_question_set(options = {})
38
+ self.post '/questions/score', options
39
+ end
40
+
41
+ def get(path, options = {})
42
+ options = { body: options, basic_auth: @auth }
43
+ puts options
44
+ self.class.get(path, options)
45
+ end
46
+
47
+ def post(path, options = {})
48
+ options = { body: options, basic_auth: @auth }
49
+ self.class.post(path, options)
50
+ end
51
+ end
52
+ end
data/test/helper.rb ADDED
@@ -0,0 +1,34 @@
1
+ require 'simplecov'
2
+
3
+ module SimpleCov::Configuration
4
+ def clean_filters
5
+ @filters = []
6
+ end
7
+ end
8
+
9
+ SimpleCov.configure do
10
+ clean_filters
11
+ load_profile 'test_frameworks'
12
+ end
13
+
14
+ ENV["COVERAGE"] && SimpleCov.start do
15
+ add_filter "/.rvm/"
16
+ end
17
+ require 'rubygems'
18
+ require 'bundler'
19
+ begin
20
+ Bundler.setup(:default, :development)
21
+ rescue Bundler::BundlerError => e
22
+ $stderr.puts e.message
23
+ $stderr.puts "Run `bundle install` to install missing gems"
24
+ exit e.status_code
25
+ end
26
+ require 'test/unit'
27
+ require 'shoulda'
28
+
29
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
30
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
31
+ require 'blockscore'
32
+
33
+ class Test::Unit::TestCase
34
+ end
@@ -0,0 +1,85 @@
1
+ require 'helper'
2
+
3
+ class TestBlockScore < Test::Unit::TestCase
4
+ context "a verification" do
5
+ setup do
6
+ @blockscore = BlockScore::Client.new("sk_test_74d0a2e9649c8eed8bbef051666e1aa2", version = 2)
7
+ end
8
+
9
+ should "return a list of verifications" do
10
+ assert_equal 200, @blockscore.get_verifications.code
11
+ end
12
+
13
+ should "return a single verification" do
14
+ assert_equal 200, @blockscore.get_verification("53099a636274639ebb0e0000").code
15
+ end
16
+
17
+ should "return create a verification" do
18
+ @json_representation = {
19
+ type: "us_citizen",
20
+ date_of_birth: "1993-08-23",
21
+ identification: {
22
+ ssn: "0000"
23
+ },
24
+ name: {
25
+ first: "Alain",
26
+ middle: nil,
27
+ last: "Meier"
28
+ },
29
+ address: {
30
+ street1: "1 Infinite Loop",
31
+ street2: nil,
32
+ city: "Cupertino",
33
+ state: "CA",
34
+ postal_code: "95014",
35
+ country: "US"
36
+ }
37
+ }
38
+
39
+ assert_equal 201, @blockscore.create_verification(@json_representation).code
40
+ end
41
+
42
+ should "return create a question set" do
43
+ @json_representation = {
44
+ verification_id: "53099a636274639ebb0e0000"
45
+ }
46
+
47
+ assert_equal 201, @blockscore.create_question_set(@json_representation).code
48
+ end
49
+
50
+ # should "return a single question set" do
51
+ # assert_equal 200, @blockscore.get_question_set("53099c5f6274639ebb7e0000").code
52
+ # end
53
+
54
+ should "return a score for the question set" do
55
+ @json_representation = {
56
+ verification_id: "53099a636274639ebb0e0000",
57
+ question_set_id: "53099c5f6274639ebb7e0000",
58
+ answers: [
59
+ {
60
+ question_id: 1,
61
+ answer_id: 1
62
+ },
63
+ {
64
+ question_id: 2,
65
+ answer_id: 1
66
+ },
67
+ {
68
+ question_id: 3,
69
+ answer_id: 1
70
+ },
71
+ {
72
+ question_id: 4,
73
+ answer_id: 1
74
+ },
75
+ {
76
+ question_id: 5,
77
+ answer_id: 1
78
+ }
79
+ ]
80
+ }
81
+
82
+ assert_equal 201, @blockscore.score_question_set(@json_representation).code
83
+ end
84
+ end
85
+ end
metadata ADDED
@@ -0,0 +1,141 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: blockscore
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Alain Meier
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-02-23 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: shoulda
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rdoc
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.12'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.12'
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: jeweler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 2.0.1
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.1
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ description: A ruby client library for the BlockScore API.
98
+ email: alain@blockscore.com
99
+ executables: []
100
+ extensions: []
101
+ extra_rdoc_files:
102
+ - LICENSE.txt
103
+ - README.md
104
+ files:
105
+ - .document
106
+ - Gemfile
107
+ - Gemfile.lock
108
+ - LICENSE.txt
109
+ - README.md
110
+ - Rakefile
111
+ - VERSION
112
+ - blockscore-ruby.sublime-project
113
+ - lib/blockscore.rb
114
+ - lib/blockscore/client.rb
115
+ - test/helper.rb
116
+ - test/test_blockscore.rb
117
+ homepage: http://github.com/blockscore/blockscore-ruby
118
+ licenses:
119
+ - MIT
120
+ metadata: {}
121
+ post_install_message:
122
+ rdoc_options: []
123
+ require_paths:
124
+ - lib
125
+ required_ruby_version: !ruby/object:Gem::Requirement
126
+ requirements:
127
+ - - '>='
128
+ - !ruby/object:Gem::Version
129
+ version: '0'
130
+ required_rubygems_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ requirements: []
136
+ rubyforge_project:
137
+ rubygems_version: 2.1.11
138
+ signing_key:
139
+ specification_version: 4
140
+ summary: A ruby client library for the BlockScore API.
141
+ test_files: []