kdonovan-trufina 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG ADDED
@@ -0,0 +1,10 @@
1
+ 0.2.2 [September 04, 2009]
2
+ * Fixed bug in present_and_verified where it choked handling arrays
3
+ * API Change: modified present_and_verified return value to be more direct (nested hashes rather than alternating hashes and arrays of hashes)
4
+
5
+ 0.2.1 [September 04, 2009]
6
+ * Embedded basic auth information directly in redirect URL when in staging mode
7
+
8
+ 0.2.0 [September 04, 2009]
9
+ * Finally supporting ResidenceAddress seed and request data
10
+ * API Change: using zip rather than postal_code
data/README.rdoc CHANGED
@@ -58,7 +58,7 @@ you'll be redirected to whatever you put as your success endpoint in +trufina.ym
58
58
  information about the user Trufina[http://www.trufina.com] has verified.
59
59
 
60
60
  info = Trufina.login_info_request(870)
61
- info.data.present_and_verified # => [{:name=>[{:first=>"FIRSTNAME"}, {:last=>"LASTNAME"}]}] (or whatever names you entered on the staging server)
61
+ info.data.present_and_verified # => {:name=>{:first=>"FIRSTNAME"}, {:last=>"LASTNAME"}} (or whatever names you entered on the staging server)
62
62
 
63
63
 
64
64
  That completes the simplest use-case. Say we decide we want more information about the user, like their middle
@@ -66,14 +66,14 @@ name. We send Trufina[http://www.trufina.com] an access request, and if the use
66
66
  permission we'll get the info back immediately.
67
67
 
68
68
  new_info = Trufina.access_request(info, {:name => [:middle]})
69
- new_info.data.present_and_verified # => [{:name=>[{:middle=>"SomeMiddleName"}]}]
69
+ new_info.data.present_and_verified # => {:name=>{:middle=>"SomeMiddleName"}}
70
70
 
71
71
 
72
72
  Note that here our demo user has already given Trufina[http://www.trufina.com] permission to see all the name components, so we get
73
73
  the middle name back immediately. For a different component where Trufina[http://www.trufina.com] needs to ask the user there's no
74
74
  useful data in the response (the XML contains a "pending" node, but the gem doesn't bother parsing it out).
75
75
 
76
- Trufina.access_request(info, [:phone]).data.present_and_verified # => []
76
+ Trufina.access_request(info, [:phone]).data.present_and_verified # => {}
77
77
 
78
78
 
79
79
  In this case we would receive an AccessNotification to our servers once the user gave us permission to access
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
data/lib/elements.rb CHANGED
@@ -71,14 +71,21 @@ class Trufina
71
71
 
72
72
  # Shortcut to collecting any information that's present and available
73
73
  def present_and_verified
74
- yes = []
75
- self.class.elements.map(&:method_name).each do |p|
74
+ yes = {}
75
+ self.class.elements.map(&:method_name).each do |p|
76
76
  next unless val = self.send(p)
77
+ element = self.class.elements.detect{|e| e.method_name == p}
77
78
 
78
79
  if val.respond_to?(:present_and_verified)
79
- yes << {p.to_sym => val.present_and_verified}
80
- else
81
- yes << {p.to_sym => val} if val.state == 'verified' && val.status == 'present'
80
+ yes[p.to_sym] = val.present_and_verified
81
+ elsif element.options[:single]
82
+ yes[p.to_sym] = val if val.state == 'verified' && val.status == 'present'
83
+ else # street_addresses is an array...
84
+ values = []
85
+ val.each do |array_item|
86
+ values << array_item if array_item.state == 'verified' && array_item.status == 'present'
87
+ end
88
+ yes[p.to_sym] = values
82
89
  end
83
90
  end
84
91
  yes
data/trufina.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{trufina}
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kali Donovan"]
12
- s.date = %q{2009-09-04}
12
+ s.date = %q{2009-09-06}
13
13
  s.description = %q{Provides a DSL to easily interact with the XML API offered by Trufina.com, an identity verification company.}
14
14
  s.email = %q{kali.donovan@gmail.com}
15
15
  s.extra_rdoc_files = [
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  ]
18
18
  s.files = [
19
19
  ".gitignore",
20
+ "CHANGELOG",
20
21
  "MIT-LICENSE",
21
22
  "README.rdoc",
22
23
  "Rakefile",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kdonovan-trufina
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kali Donovan
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-09-04 00:00:00 -07:00
12
+ date: 2009-09-06 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -32,6 +32,7 @@ extra_rdoc_files:
32
32
  - README.rdoc
33
33
  files:
34
34
  - .gitignore
35
+ - CHANGELOG
35
36
  - MIT-LICENSE
36
37
  - README.rdoc
37
38
  - Rakefile
@@ -63,6 +64,7 @@ files:
63
64
  - trufina.yml.template
64
65
  has_rdoc: false
65
66
  homepage: http://github.com/kdonovan/trufina
67
+ licenses:
66
68
  post_install_message:
67
69
  rdoc_options:
68
70
  - --charset=UTF-8
@@ -83,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
83
85
  requirements: []
84
86
 
85
87
  rubyforge_project:
86
- rubygems_version: 1.2.0
88
+ rubygems_version: 1.3.5
87
89
  signing_key:
88
90
  specification_version: 3
89
91
  summary: DSL to easily interact with Trufina's verification API