beenverified 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +6 -0
- data/Manifest.txt +15 -0
- data/README.txt +125 -0
- data/Rakefile +19 -0
- data/bin/beenverified +0 -0
- data/lib/beenverified.rb +69 -0
- data/lib/beenverified/client.rb +128 -0
- data/lib/beenverified/credentials.rb +49 -0
- data/lib/beenverified/response.rb +22 -0
- data/lib/beenverified/user.rb +46 -0
- data/spec/simple_spec.rb +12 -0
- data/test/test_beenverified.rb +0 -0
- data/test/test_helper.rb +7 -0
- data/test/test_user.rb +113 -0
- metadata +80 -0
data/History.txt
ADDED
data/Manifest.txt
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
History.txt
|
2
|
+
Manifest.txt
|
3
|
+
README.txt
|
4
|
+
Rakefile
|
5
|
+
bin/beenverified
|
6
|
+
lib/beenverified.rb
|
7
|
+
lib/beenverified/client.rb
|
8
|
+
lib/beenverified/credentials.rb
|
9
|
+
lib/beenverified/response.rb
|
10
|
+
lib/beenverified/user.rb
|
11
|
+
test/test_beenverified.rb
|
12
|
+
spec/simple_spec.rb
|
13
|
+
test/test_beenverified.rb
|
14
|
+
test/test_helper.rb
|
15
|
+
test/test_user.rb
|
data/README.txt
ADDED
@@ -0,0 +1,125 @@
|
|
1
|
+
== beenverified
|
2
|
+
|
3
|
+
http://beenverifiedapi.rubyforge.net/
|
4
|
+
|
5
|
+
== 0.1.0
|
6
|
+
|
7
|
+
== DESCRIPTION:
|
8
|
+
|
9
|
+
BeenVerified is a web service designed to build trust into the meetings
|
10
|
+
and interactions that take place on websites and online communities.
|
11
|
+
Built using the OAuth protocol and with a focus on keeping the user in
|
12
|
+
complete control of their data, the BeenVerified API allows users to
|
13
|
+
present third-party, verified information about themselves within your
|
14
|
+
application. That verified user data (such as their identity and
|
15
|
+
credentials) can then be integrated directly into your application's
|
16
|
+
look and feel, providing a more trustworthy user experience for
|
17
|
+
everyone
|
18
|
+
|
19
|
+
|
20
|
+
== FEATURES/PROBLEMS:
|
21
|
+
|
22
|
+
* Wraps OAuth authentication
|
23
|
+
* Wraps XML responses into a User object
|
24
|
+
* User object has control of a hash of Credential objects
|
25
|
+
|
26
|
+
== DEVELOPER KEY:
|
27
|
+
|
28
|
+
Before you can access data from the BeenVerified Library, you must obtain a developer key at:
|
29
|
+
http://www.beenverified.com/developer/new?d=t
|
30
|
+
|
31
|
+
== USAGE:
|
32
|
+
|
33
|
+
Three Steps
|
34
|
+
|
35
|
+
|
36
|
+
==== 1) Obtaining a request token & sending user to Auth[sz]
|
37
|
+
|
38
|
+
>> require 'beenverified
|
39
|
+
>> client = BeenVerified::Client.new( :consumer_key => "consumer_key",
|
40
|
+
:consumer_secret => "consumer_secret")
|
41
|
+
>> request_token = client.get_request_token
|
42
|
+
|
43
|
+
#save your request_token data to your database
|
44
|
+
#send user to request_token.authorize_url
|
45
|
+
#User comes back to app to notify of authorization
|
46
|
+
#(in a web flow it would be a redirect to the callback URL)
|
47
|
+
|
48
|
+
==== 2) Getting the access token
|
49
|
+
|
50
|
+
>> client = BeenVerified::Client.new( :consumer_key => "consumer_key",
|
51
|
+
:consumer_secret => "consumer_secret",
|
52
|
+
:request_token => "request_token",
|
53
|
+
:request_token_secret => "request_token_secret")
|
54
|
+
>> access_token = client.convert_to_access_token
|
55
|
+
|
56
|
+
#save access_token data to your database
|
57
|
+
|
58
|
+
==== 3) Accessing BeenVerified Resources
|
59
|
+
|
60
|
+
>> user = BeenVerified::Client.new( :consumer_key => "consumer_key",
|
61
|
+
:consumer_secret => "consumer_secret",
|
62
|
+
:access_token => "access_token",
|
63
|
+
:access_token_secret => "access_token_secret").user
|
64
|
+
|
65
|
+
=> <BeenVerified::User:0x02cf909 ...>
|
66
|
+
|
67
|
+
#showing a users full name if they are sharing it
|
68
|
+
>> user.identity.full_name if user.identity
|
69
|
+
=> "Jason Amster"
|
70
|
+
|
71
|
+
#showing the name of the organization where a user worked
|
72
|
+
>> user.work_experiences[0].organization if user.work_experiences[0].size > 0
|
73
|
+
=> "BeenVerified"
|
74
|
+
|
75
|
+
#showing the date the work_experience credential was verified
|
76
|
+
user.work_experiences[0].verified_on
|
77
|
+
|
78
|
+
#displaying the raw xml of a user
|
79
|
+
>> user.raw_xml
|
80
|
+
=> <?xml version="1.0" encoding="UTF-8"?>
|
81
|
+
<user>
|
82
|
+
<link_back>http://localhost/personas/cb79d21f</link_back>
|
83
|
+
<credentials>
|
84
|
+
...
|
85
|
+
</credentials>
|
86
|
+
</user>
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
== REQUIREMENTS:
|
93
|
+
|
94
|
+
oauth
|
95
|
+
net/https
|
96
|
+
activesupport
|
97
|
+
|
98
|
+
== INSTALL:
|
99
|
+
|
100
|
+
sudo gem install beenverified
|
101
|
+
|
102
|
+
== LICENSE:
|
103
|
+
|
104
|
+
(The MIT License)
|
105
|
+
|
106
|
+
Copyright (c) 2008 Jason Amster
|
107
|
+
|
108
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
109
|
+
a copy of this software and associated documentation files (the
|
110
|
+
'Software'), to deal in the Software without restriction, including
|
111
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
112
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
113
|
+
permit persons to whom the Software is furnished to do so, subject to
|
114
|
+
the following conditions:
|
115
|
+
|
116
|
+
The above copyright notice and this permission notice shall be
|
117
|
+
included in all copies or substantial portions of the Software.
|
118
|
+
|
119
|
+
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
|
120
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
121
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
122
|
+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
123
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
124
|
+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
125
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'hoe'
|
5
|
+
require './lib/beenverified.rb'
|
6
|
+
require 'fileutils'
|
7
|
+
|
8
|
+
Hoe.new('beenverified', BeenVerified::VERSION) do |p|
|
9
|
+
p.rubyforge_name = 'beenverified' # if different than lowercase project name
|
10
|
+
p.developer('Jason Amster', 'jayamster@gmail.com')
|
11
|
+
end
|
12
|
+
|
13
|
+
# vim: syntax=Ruby
|
14
|
+
|
15
|
+
|
16
|
+
desc "Install GEM Locally"
|
17
|
+
task :install_locally => [:install_gem] do
|
18
|
+
FileUtils.rm_rf File.dirname(__FILE__) + '/pkg'
|
19
|
+
end
|
data/bin/beenverified
ADDED
File without changes
|
data/lib/beenverified.rb
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'net/https'
|
2
|
+
require 'rubygems'
|
3
|
+
gem 'oauth', ">= 0.2.1"
|
4
|
+
require 'oauth/helper'
|
5
|
+
require 'oauth/client/helper'
|
6
|
+
require 'oauth/request_proxy/net_http'
|
7
|
+
require 'activesupport'
|
8
|
+
|
9
|
+
#require 'hpricot'
|
10
|
+
|
11
|
+
class BeenVerified
|
12
|
+
VERSION = '0.1.0'
|
13
|
+
API_SERVER = "https://api.beenverified.com"
|
14
|
+
AUTH_SERVER = "https://www.beenverified.com"
|
15
|
+
DEBUG_API_SERVER = "http://localhost"
|
16
|
+
DEBUG_AUTH_SERVER = "http://localhost"
|
17
|
+
|
18
|
+
API_PREFIX = "/rest/1.0"
|
19
|
+
FORMAT_XML = "xml"
|
20
|
+
REQUEST_TOKEN_PATH= "/oauth/request_token"
|
21
|
+
ACCESS_TOKEN_PATH= "/oauth/access_token"
|
22
|
+
AUTHORIZE_PATH= "/oauth/authorize"
|
23
|
+
USER_API_PATH="#{BeenVerified::API_PREFIX}/user/show"
|
24
|
+
|
25
|
+
#CREDENTIAL_TYPES_PLURAL = %w(work_experiences educations professional_licenses certifications personal_references emails web_sites)
|
26
|
+
#CREDENTIAL_TYPES = %w(work_experience education professional_license certification personal_reference email web_site)
|
27
|
+
#CREDENTAIL_CLASSES = %w(WorkExperience Education ProfessionalLicense Certification PersonalReference Email WebSite)
|
28
|
+
CREDENTIALS = {:identity=>{:singular=>'identity', :plural=>'identities', :class=>'Identity'},
|
29
|
+
:work_experience=>{:singular=>'work_experience', :plural=>'work_experiences', :class=>'WorkExperience'},
|
30
|
+
:education=>{:singular=>'education', :plural=>'educations', :class=>'Education'},
|
31
|
+
:professional_license=>{:singular=>'professional_license', :plural=>'professional_licenses', :class=>'ProfessionalLicense'},
|
32
|
+
:certification=>{:singular=>'certification', :plural=>'certifications', :class=>'Certification'},
|
33
|
+
:personal_reference=>{:singular=>'personal_reference', :plural=>'personal_references', :class=>'PersonalReference'},
|
34
|
+
:email=>{:singular=>'email', :plural=>'emails', :class=>'Email'},
|
35
|
+
:web_site=>{:singular=>'web_site', :plural=>'web_sites', :class=>'WebSite'}}
|
36
|
+
|
37
|
+
class Error < RuntimeError #:nodoc:
|
38
|
+
end
|
39
|
+
|
40
|
+
class ArgumentError < Error #:nodoc:
|
41
|
+
end
|
42
|
+
|
43
|
+
class BeenVerifiedException < Error #:nodoc:
|
44
|
+
end
|
45
|
+
|
46
|
+
#To convert each key to a getter method for the class
|
47
|
+
#as seen at: http://blog.jayfields.com/2008/02/ruby-dynamically-define-method.html
|
48
|
+
|
49
|
+
end
|
50
|
+
class Hash
|
51
|
+
def to_mod
|
52
|
+
hash = self
|
53
|
+
Module.new do
|
54
|
+
hash.each_pair do |key, value|
|
55
|
+
define_method key do
|
56
|
+
value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
#Dir['beenverified/**/*.rb'].sort.each { |lib| require lib }\
|
64
|
+
#require File.dirname(__FILE__) + '/beenverified/client'
|
65
|
+
|
66
|
+
require File.dirname(__FILE__) + '/beenverified/client'
|
67
|
+
require File.dirname(__FILE__) + '/beenverified/response'
|
68
|
+
require File.dirname(__FILE__) + '/beenverified/user'
|
69
|
+
require File.dirname(__FILE__) + '/beenverified/credentials'
|
@@ -0,0 +1,128 @@
|
|
1
|
+
class BeenVerified
|
2
|
+
class Client
|
3
|
+
attr_reader :access_token, :request_token, :consumer, :format
|
4
|
+
#attr_accessor :consumer
|
5
|
+
|
6
|
+
def initialize(options = {})
|
7
|
+
options = {
|
8
|
+
:debug => false,
|
9
|
+
:format => BeenVerified::FORMAT_XML
|
10
|
+
}.merge(options)
|
11
|
+
|
12
|
+
# symbolize keys
|
13
|
+
options.map do |k,v|
|
14
|
+
options[k.to_sym] = v
|
15
|
+
end
|
16
|
+
site = if options[:debug]
|
17
|
+
BeenVerified::DEBUG_API_SERVER
|
18
|
+
else
|
19
|
+
BeenVerified::API_SERVER
|
20
|
+
end
|
21
|
+
|
22
|
+
raise BeenVerified::ArgumentError, "OAuth Consumer Key and Secret required" if options[:consumer_key].nil? || options[:consumer_secret].nil?
|
23
|
+
@consumer = OAuth::Consumer.new(options[:consumer_key], options[:consumer_secret],{
|
24
|
+
:site=>site,
|
25
|
+
:scheme=>:header,
|
26
|
+
:http_method=>:post,
|
27
|
+
:request_token_path=>BeenVerified::REQUEST_TOKEN_PATH,
|
28
|
+
:access_token_path=>BeenVerified::ACCESS_TOKEN_PATH,
|
29
|
+
:authorize_path=>BeenVerified::AUTHORIZE_PATH
|
30
|
+
})
|
31
|
+
@debug = options[:debug]
|
32
|
+
@format = options[:format]
|
33
|
+
# @app_id = options[:app_id]
|
34
|
+
if options[:access_token] && options[:access_token_secret]
|
35
|
+
@access_token = OAuth::AccessToken.new(@consumer, options[:access_token], options[:access_token_secret])
|
36
|
+
else
|
37
|
+
@access_token = nil
|
38
|
+
end
|
39
|
+
if options[:request_token] && options[:request_token_secret]
|
40
|
+
@request_token = OAuth::RequestToken.new(@consumer, options[:request_token], options[:request_token_secret])
|
41
|
+
else
|
42
|
+
@request_token = nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def get_request_token(force_token_regeneration = false)
|
47
|
+
if force_token_regeneration || @request_token.nil?
|
48
|
+
@request_token = consumer.get_request_token
|
49
|
+
end
|
50
|
+
@request_token
|
51
|
+
end
|
52
|
+
|
53
|
+
def authorization_url
|
54
|
+
raise BeenVerified::ArgumentError, "call #get_request_token first" if @request_token.nil?
|
55
|
+
request_token.authorize_url
|
56
|
+
end
|
57
|
+
|
58
|
+
def convert_to_access_token
|
59
|
+
raise BeenVerified::ArgumentError, "call #get_request_token and have user authorize the token first" if @request_token.nil?
|
60
|
+
@access_token = request_token.get_access_token
|
61
|
+
end
|
62
|
+
|
63
|
+
def user(options={})
|
64
|
+
raise BeenVerified::ArgumentError, "OAuth Access Token Required" unless @access_token
|
65
|
+
response = get(BeenVerified::USER_API_PATH + ".#{format}", options)
|
66
|
+
response
|
67
|
+
BeenVerified::Response.new(response.body).user
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
alias_method :method_missing_with_type_filter, :method_missing
|
72
|
+
def method_missing_with_type_filter(method_id, *arguments)
|
73
|
+
if match = /^get_([_a-zA-Z]\w*|[_a-zA-Z]\w*s)$/.match(method_id.to_s)
|
74
|
+
if credential_type_match(match.captures.first)
|
75
|
+
credential_type = match.captures.first
|
76
|
+
if credential_type[-1..credential_type.length]=='s'
|
77
|
+
get("#{API_PREFIX}/#{credential_type}.xml")
|
78
|
+
else
|
79
|
+
get("#{API_PREFIX}/#{credential_type}s/#{arguments[0]}.xml")
|
80
|
+
end
|
81
|
+
else
|
82
|
+
method_missing_without_type_filter(method_id, *arguments)
|
83
|
+
end
|
84
|
+
else
|
85
|
+
method_missing_without_type_filter(method_id, *arguments)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
alias_method :method_missing, :method_missing_with_type_filter
|
89
|
+
|
90
|
+
|
91
|
+
private
|
92
|
+
def credential_type_match(cred_type)
|
93
|
+
compare = cred_type[-1..cred_type.length]=='s' ? cred_type[0..cred_type.length-2] : cred_type
|
94
|
+
if BeenVerified::CREDENTIAL_TYPES.include?(compare)
|
95
|
+
true
|
96
|
+
else
|
97
|
+
false
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
protected
|
102
|
+
|
103
|
+
def get(url, options = {}) #:nodoc:
|
104
|
+
request(:get, url, options)
|
105
|
+
end
|
106
|
+
|
107
|
+
def request(method, url, options) #:nodoc:
|
108
|
+
response = case method
|
109
|
+
#when :post
|
110
|
+
# access_token.request(:post, url, options[:params])
|
111
|
+
when :get
|
112
|
+
qs = options[:params].collect { |k,v| "#{CGI.escape(k.to_s)}=#{CGI.escape(v.to_s)}" }.join("&") if options[:params]
|
113
|
+
access_token.request(:get, "#{url}?#{qs}")
|
114
|
+
else
|
115
|
+
raise ArgumentError, "method #{method} not supported"
|
116
|
+
end
|
117
|
+
|
118
|
+
case response.code
|
119
|
+
when '500'; then raise BeenVerified::BeenVerifiedException, "Internal Server Error"
|
120
|
+
when '400'; then raise BeenVerified::BeenVerifiedException, "Method Not Implemented Yet"
|
121
|
+
when '401'; then raise BeenVerified::BeenVerifiedException, "Token not Found"
|
122
|
+
else response
|
123
|
+
end
|
124
|
+
end
|
125
|
+
|
126
|
+
|
127
|
+
end
|
128
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
class BeenVerified
|
2
|
+
class Credential
|
3
|
+
attr_accessor :id
|
4
|
+
def initialize(data=nil)
|
5
|
+
unless data
|
6
|
+
@data_hash = nil
|
7
|
+
return
|
8
|
+
else
|
9
|
+
@id = data.attributes["id"]
|
10
|
+
@data_hash ={}
|
11
|
+
data.elements.each do |data_point|
|
12
|
+
@data_hash[data_point.name.to_sym]=data_point.text
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
methods = @data_hash.reject{|key, val| key==:verified_on}
|
17
|
+
self.extend methods.to_mod
|
18
|
+
end
|
19
|
+
|
20
|
+
def [](index)
|
21
|
+
if @data_hash==nil
|
22
|
+
return nil
|
23
|
+
else
|
24
|
+
return @data_hash[index]
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def verified_on
|
29
|
+
Date.parse(@data_hash[:verified_on])
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class Identity < Credential
|
35
|
+
def full_name
|
36
|
+
"#{@data_hash[:first_name]} #{@data_hash[:last_name]}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class WorkExperience < Credential;end
|
41
|
+
class Education < Credential;end
|
42
|
+
class ProfessionalLicense < Credential;end
|
43
|
+
class Certification < Credential;end
|
44
|
+
class PersonalReference < Credential;end
|
45
|
+
class Email < Credential;end
|
46
|
+
class WebSite < Credential;end
|
47
|
+
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
class BeenVerified
|
2
|
+
class Response
|
3
|
+
|
4
|
+
#Parses the XML response from BeenVerified
|
5
|
+
def initialize(doc)
|
6
|
+
doc = REXML::Document.new(doc) unless doc.is_a?(REXML::Document || REXML::Element)
|
7
|
+
@doc = doc
|
8
|
+
raise BeenVerified::BeenVerifiedException, @doc.elements['error'].attributes["error_code"] if !success?
|
9
|
+
end
|
10
|
+
|
11
|
+
#does the response indicate success?
|
12
|
+
def success?
|
13
|
+
@doc.elements['error'].nil?
|
14
|
+
end
|
15
|
+
|
16
|
+
def user
|
17
|
+
@user ||= BeenVerified::User.new(@doc)
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
class BeenVerified
|
2
|
+
class User
|
3
|
+
attr_accessor :raw_xml, :link_back, :credentials, *BeenVerified::CREDENTIALS.map{|credential_type| credential_type[1][:plural].to_sym}
|
4
|
+
def initialize(doc)
|
5
|
+
@raw_xml = doc.root
|
6
|
+
@link_back = doc.root.elements['link_back'].text
|
7
|
+
|
8
|
+
#Cycle through all element types and see if there are any of them in the xml response
|
9
|
+
@credentials = {}
|
10
|
+
BeenVerified::CREDENTIALS.each do |credential_type|
|
11
|
+
|
12
|
+
#set array to empty set
|
13
|
+
type_array = []
|
14
|
+
|
15
|
+
#Get the matching xml node
|
16
|
+
credentials = doc.root.elements['credentials'].elements[credential_type[1][:plural]]
|
17
|
+
|
18
|
+
#if there are credentials of this type, cycle through and instantiate objects of them
|
19
|
+
#and add it to the array
|
20
|
+
if credentials
|
21
|
+
klass = "BeenVerified::#{credential_type[1][:class]}".constantize
|
22
|
+
credentials.elements.each do |credential|
|
23
|
+
type_array << klass.new(credential)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
eval("@#{credential_type[1][:plural]} = type_array")
|
27
|
+
@credentials[credential_type[1][:plural]] = type_array
|
28
|
+
#puts @credentials.size
|
29
|
+
end
|
30
|
+
|
31
|
+
def number_of_credentials
|
32
|
+
credentials.inject(0){|sum, type| sum = sum+type[1].size }
|
33
|
+
end
|
34
|
+
|
35
|
+
def identity
|
36
|
+
unless identities.empty?
|
37
|
+
identities[0]
|
38
|
+
else
|
39
|
+
nil
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
|
data/spec/simple_spec.rb
ADDED
File without changes
|
data/test/test_helper.rb
ADDED
data/test/test_user.rb
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require "rexml/document"
|
3
|
+
require File.dirname(__FILE__) + '/test_helper.rb'
|
4
|
+
|
5
|
+
|
6
|
+
class TestUser < Test::Unit::TestCase
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@basic_user = <<DATA
|
10
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
11
|
+
<user>
|
12
|
+
<link_back>http://localhost/personas/cb79d21f</link_back>
|
13
|
+
<credentials>
|
14
|
+
<identities>
|
15
|
+
<identity id="2">
|
16
|
+
<first_name>Jason</first_name>
|
17
|
+
<last_name>Amster</last_name>
|
18
|
+
<middle_name></middle_name>
|
19
|
+
<suffix></suffix>
|
20
|
+
<verified_on>09/26/2007</verified_on>
|
21
|
+
<source></source>
|
22
|
+
<notes></notes>
|
23
|
+
</identity>
|
24
|
+
</identities>
|
25
|
+
<educations>
|
26
|
+
<education id="1">
|
27
|
+
<school>Rutgers University</school>
|
28
|
+
<major>Computer Science</major>
|
29
|
+
<minor></minor>
|
30
|
+
<start_date></start_date>
|
31
|
+
<graduation_date>2003-06-01</graduation_date>
|
32
|
+
<verified_on>09/15/2007</verified_on>
|
33
|
+
<source></source>
|
34
|
+
<notes>
|
35
|
+
</notes>
|
36
|
+
</education>
|
37
|
+
</educations>
|
38
|
+
<work_experiences>
|
39
|
+
<work_experience id="1">
|
40
|
+
<organization>Redken/L'Oreal USA</organization>
|
41
|
+
<title>Manager - Interactive Development</title>
|
42
|
+
<start_date>2004-08-01</start_date>
|
43
|
+
<end_date>2007-08-01</end_date>
|
44
|
+
<verified_on>09/22/2007</verified_on>
|
45
|
+
<source></source>
|
46
|
+
<notes></notes>
|
47
|
+
</work_experience>
|
48
|
+
<work_experience id="2">
|
49
|
+
<organization>BeenVerified.com</organization>
|
50
|
+
<title>CTO</title>
|
51
|
+
<start_date>2007-08-01</start_date>
|
52
|
+
<end_date></end_date>
|
53
|
+
<verified_on>10/31/2007</verified_on>
|
54
|
+
<source></source>
|
55
|
+
<notes></notes>
|
56
|
+
</work_experience>
|
57
|
+
</work_experiences>
|
58
|
+
</credentials>
|
59
|
+
</user>
|
60
|
+
DATA
|
61
|
+
|
62
|
+
|
63
|
+
@empty_user = <<DATA
|
64
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
65
|
+
<user>
|
66
|
+
<link_back>http://localhost/personas/cb79d21f</link_back>
|
67
|
+
<credentials>
|
68
|
+
|
69
|
+
</credentials>
|
70
|
+
</user>
|
71
|
+
DATA
|
72
|
+
|
73
|
+
@basic_user = REXML::Document.new(@basic_user, {:compress_whitespace => %(credentials)})#file
|
74
|
+
@empty_user = REXML::Document.new(@empty_user, {:compress_whitespace => %(credentials)})#file
|
75
|
+
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_initialize
|
80
|
+
user = BeenVerified::User.new(@basic_user)
|
81
|
+
assert user
|
82
|
+
|
83
|
+
end
|
84
|
+
def test_basic_user
|
85
|
+
user = BeenVerified::User.new(@basic_user)
|
86
|
+
assert_equal 4, user.number_of_credentials
|
87
|
+
assert_equal 2, user.work_experiences.size
|
88
|
+
assert_equal 1, user.educations.size
|
89
|
+
assert user.web_sites, nil
|
90
|
+
assert_equal 'http://localhost/personas/cb79d21f', user.link_back
|
91
|
+
assert user.identity
|
92
|
+
|
93
|
+
end
|
94
|
+
def test_credential_values
|
95
|
+
user = BeenVerified::User.new(@basic_user)
|
96
|
+
assert_equal "Jason Amster", user.identity.full_name
|
97
|
+
assert_equal "Redken/L'Oreal USA", user.work_experiences.first[:organization]
|
98
|
+
assert_equal Date, user.work_experiences.first.verified_on.class
|
99
|
+
assert_equal '1', user.work_experiences.first.id
|
100
|
+
assert_equal '2', user.work_experiences[1].id
|
101
|
+
assert_equal 'Computer Science', user.educations[0].major
|
102
|
+
assert_equal 'Computer Science', user.educations[0][:major]
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
def test_simple_user
|
107
|
+
user = BeenVerified::User.new(@empty_user)
|
108
|
+
assert_equal 0, user.number_of_credentials
|
109
|
+
BeenVerified::CREDENTIALS.map{|type| type[1][:plural]}.each do |type|
|
110
|
+
assert eval("user.#{type}.empty?")
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
metadata
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: beenverified
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jason Amster
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-08 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.5.1
|
23
|
+
version:
|
24
|
+
description: BeenVerified is a web service designed to build trust into the meetings and interactions that take place on websites and online communities. Built using the OAuth protocol and with a focus on keeping the user in complete control of their data, the BeenVerified API allows users to present third-party, verified information about themselves within your application. That verified user data (such as their identity and credentials) can then be integrated directly into your application's look and feel, providing a more trustworthy user experience for everyone
|
25
|
+
email:
|
26
|
+
- jayamster@gmail.com
|
27
|
+
executables:
|
28
|
+
- beenverified
|
29
|
+
extensions: []
|
30
|
+
|
31
|
+
extra_rdoc_files:
|
32
|
+
- History.txt
|
33
|
+
- Manifest.txt
|
34
|
+
- README.txt
|
35
|
+
files:
|
36
|
+
- History.txt
|
37
|
+
- Manifest.txt
|
38
|
+
- README.txt
|
39
|
+
- Rakefile
|
40
|
+
- bin/beenverified
|
41
|
+
- lib/beenverified.rb
|
42
|
+
- lib/beenverified/client.rb
|
43
|
+
- lib/beenverified/credentials.rb
|
44
|
+
- lib/beenverified/response.rb
|
45
|
+
- lib/beenverified/user.rb
|
46
|
+
- test/test_beenverified.rb
|
47
|
+
- spec/simple_spec.rb
|
48
|
+
- test/test_helper.rb
|
49
|
+
- test/test_user.rb
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://beenverifiedapi.rubyforge.net/
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options:
|
54
|
+
- --main
|
55
|
+
- README.txt
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
70
|
+
requirements: []
|
71
|
+
|
72
|
+
rubyforge_project: beenverified
|
73
|
+
rubygems_version: 1.0.1
|
74
|
+
signing_key:
|
75
|
+
specification_version: 2
|
76
|
+
summary: BeenVerified is a web service designed to build trust into the meetings and interactions that take place on websites and online communities
|
77
|
+
test_files:
|
78
|
+
- test/test_beenverified.rb
|
79
|
+
- test/test_helper.rb
|
80
|
+
- test/test_user.rb
|