openid_couchdb_store 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/openid_couchdb_store.rb +7 -1
- data/openid_couchdb_store.gemspec +2 -2
- data/test/helper.rb +4 -5
- data/test/test_openid_couchdb_store.rb +6 -0
- metadata +4 -4
    
        data/VERSION
    CHANGED
    
    | @@ -1 +1 @@ | |
| 1 | 
            -
            0.0. | 
| 1 | 
            +
            0.0.2
         | 
    
        data/lib/openid_couchdb_store.rb
    CHANGED
    
    | @@ -74,10 +74,16 @@ module OpenidCouchdbStore | |
| 74 74 | 
             
                def store_association(server_url, association)
         | 
| 75 75 | 
             
                  remove_association(server_url, association.handle)
         | 
| 76 76 |  | 
| 77 | 
            +
                  issued = if association.issued.to_s =~ /\A\d+\Z/
         | 
| 78 | 
            +
                    association.issued
         | 
| 79 | 
            +
                  else
         | 
| 80 | 
            +
                    Time.parse(association.issued).to_i
         | 
| 81 | 
            +
                  end
         | 
| 82 | 
            +
             | 
| 77 83 | 
             
                  assoc = OpenidCouchdbStore::Association.create('server_url' => server_url,
         | 
| 78 84 | 
             
                                     'handle'     => association.handle,
         | 
| 79 85 | 
             
                                     'secret'     => OpenID::Util.to_base64(association.secret),
         | 
| 80 | 
            -
                                     'issued'     =>  | 
| 86 | 
            +
                                     'issued'     => issued,
         | 
| 81 87 | 
             
                                     'lifetime'   => association.lifetime,
         | 
| 82 88 | 
             
                                     'assoc_type' => association.assoc_type)
         | 
| 83 89 | 
             
                  assoc
         | 
| @@ -5,11 +5,11 @@ | |
| 5 5 |  | 
| 6 6 | 
             
            Gem::Specification.new do |s|
         | 
| 7 7 | 
             
              s.name = %q{openid_couchdb_store}
         | 
| 8 | 
            -
              s.version = "0.0. | 
| 8 | 
            +
              s.version = "0.0.2"
         | 
| 9 9 |  | 
| 10 10 | 
             
              s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
         | 
| 11 11 | 
             
              s.authors = ["Sam Schenkman-Moore"]
         | 
| 12 | 
            -
              s.date = %q{2010- | 
| 12 | 
            +
              s.date = %q{2010-10-01}
         | 
| 13 13 | 
             
              s.description = %q{OpenID store using CouchDB. Right now using Couchrest, will make more flexible later, hopefully.}
         | 
| 14 14 | 
             
              s.email = %q{samsm@samsm.com}
         | 
| 15 15 | 
             
              s.extra_rdoc_files = [
         | 
    
        data/test/helper.rb
    CHANGED
    
    | @@ -41,7 +41,7 @@ class Test::Unit::TestCase | |
| 41 41 | 
             
                        'issued'     => too_old_association_timestamp,
         | 
| 42 42 | 
             
                        'lifetime'   => lifetime,
         | 
| 43 43 | 
             
                        'assoc_type' => assoc_type,
         | 
| 44 | 
            -
                        ' | 
| 44 | 
            +
                        'expires_at'  => (too_old_association_timestamp + lifetime)}
         | 
| 45 45 | 
             
                store.association.create(doc)
         | 
| 46 46 | 
             
              end
         | 
| 47 47 |  | 
| @@ -69,9 +69,8 @@ class Test::Unit::TestCase | |
| 69 69 | 
             
                timestamp - (60*60*24*365) # year old
         | 
| 70 70 | 
             
              end
         | 
| 71 71 |  | 
| 72 | 
            -
              def store_association( | 
| 73 | 
            -
                association = OpenID::Association.new(handle, secret,  | 
| 74 | 
            -
                opts.each_pair {|k,v| association.send "#{k}=", v}
         | 
| 72 | 
            +
              def store_association(issued = timestamp)
         | 
| 73 | 
            +
                association = OpenID::Association.new(handle, secret, issued, lifetime, assoc_type)
         | 
| 75 74 | 
             
                store.store_association(server_url,association)
         | 
| 76 75 | 
             
              end
         | 
| 77 76 |  | 
| @@ -80,7 +79,7 @@ class Test::Unit::TestCase | |
| 80 79 | 
             
              end
         | 
| 81 80 |  | 
| 82 81 | 
             
              def server_url
         | 
| 83 | 
            -
                "http://localhost | 
| 82 | 
            +
                "http://localhost|normal"
         | 
| 84 83 | 
             
              end
         | 
| 85 84 |  | 
| 86 85 | 
             
              def handle
         | 
| @@ -15,6 +15,12 @@ class TestOpenidCouchdbStore < Test::Unit::TestCase | |
| 15 15 | 
             
                assert assoc.secret == secret
         | 
| 16 16 | 
             
              end
         | 
| 17 17 |  | 
| 18 | 
            +
              def test_text_date_association
         | 
| 19 | 
            +
                store_association(Time.now.to_s)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                assert get_association
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 18 24 | 
             
              def test_remove_association
         | 
| 19 25 | 
             
                store_association
         | 
| 20 26 |  | 
    
        metadata
    CHANGED
    
    | @@ -1,13 +1,13 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: openid_couchdb_store
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              hash:  | 
| 4 | 
            +
              hash: 27
         | 
| 5 5 | 
             
              prerelease: false
         | 
| 6 6 | 
             
              segments: 
         | 
| 7 7 | 
             
              - 0
         | 
| 8 8 | 
             
              - 0
         | 
| 9 | 
            -
              -  | 
| 10 | 
            -
              version: 0.0. | 
| 9 | 
            +
              - 2
         | 
| 10 | 
            +
              version: 0.0.2
         | 
| 11 11 | 
             
            platform: ruby
         | 
| 12 12 | 
             
            authors: 
         | 
| 13 13 | 
             
            - Sam Schenkman-Moore
         | 
| @@ -15,7 +15,7 @@ autorequire: | |
| 15 15 | 
             
            bindir: bin
         | 
| 16 16 | 
             
            cert_chain: []
         | 
| 17 17 |  | 
| 18 | 
            -
            date: 2010- | 
| 18 | 
            +
            date: 2010-10-01 00:00:00 -04:00
         | 
| 19 19 | 
             
            default_executable: 
         | 
| 20 20 | 
             
            dependencies: 
         | 
| 21 21 | 
             
            - !ruby/object:Gem::Dependency 
         |