glogin 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 344fc68993c5eb7e5234ee2039779ea46dabf2d5
4
- data.tar.gz: f01d6910ce8a3066b44ef18aceb4ebe2623cfcba
3
+ metadata.gz: 91eaf728f89d7df67e02fb776f641d0dbb9eaad6
4
+ data.tar.gz: 3ccd883106d2a73d7a6403cc7717d8eb43906e09
5
5
  SHA512:
6
- metadata.gz: 2bed8f2877ddceae15a197f8ae0f81366b5cd0ac5d0e14f6389d9d5fc074f89ed537d915b670052c3a6442c589f119c8405b7313d92b08915fa43b10b95ea3ee
7
- data.tar.gz: f223e37df06787e2a948372fff840ed77ec4fa30de65e0e63725db859ffc981e878fdda8748f60ab6a2486e000049055d58ec0a2c35032b2aafad37a1d3ca542
6
+ metadata.gz: 76d70336859f832eb7afb809e1870d8fbf046d64e84bdffb318c4e7e6d5a006c56c4e9c8fa91190bf530612345184c6e7ad82fbfdcb9c46a0cae2db46ece0a61
7
+ data.tar.gz: e78090746591f5207e349188e91adb13644eb976408de12a7cdd1ff4f853de86cb23099a1a669d2b50c912d81093d18deac4f8f65213ba954044468f6266d20b
data/README.md CHANGED
@@ -93,7 +93,25 @@ settings.glogin.login_uri
93
93
 
94
94
  For unit testing you can just provide an empty string as a `secret` for
95
95
  `GLogin::Cookie::Open` and `GLogin::Cookie::Closed` and the encryption will be disabled:
96
- whatever will be coming from the cookie will be trusted.
96
+ whatever will be coming from the cookie will be trusted. For testing
97
+ it will be convenient to provide a user name in a query string, like:
98
+
99
+ ```
100
+ http://localhost:9292/?glogin=tester
101
+ ```
102
+
103
+ To enable that, it's recommended to add this line (see how
104
+ it works in [zold-io/wts.zold.io](https://github.com/zold-io/wts.zold.io)):
105
+
106
+ ```ruby
107
+ require 'sinatra/cookies'
108
+ before '/*' do
109
+ cookies[:glogin] = params[:glogin] if params[:glogin]
110
+ if cookies[:glogin]
111
+ # same as above
112
+ end
113
+ end
114
+ ```
97
115
 
98
116
  I use this gem in [sixnines](https://github.com/yegor256/sixnines)
99
117
  and [0pdd](https://github.com/yegor256/0pdd) web apps (both open source),
data/glogin.gemspec CHANGED
@@ -32,7 +32,7 @@ Gem::Specification.new do |s|
32
32
  s.required_rubygems_version = Gem::Requirement.new('>= 0')
33
33
  end
34
34
  s.rubygems_version = '2.2.2'
35
- s.required_ruby_version = '>= 1.9.3'
35
+ s.required_ruby_version = '~>2.0'
36
36
  s.name = 'glogin'
37
37
  s.version = GLogin::VERSION
38
38
  s.license = 'MIT'
@@ -43,7 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.homepage = 'http://github.com/yegor256/glogin'
44
44
  s.files = `git ls-files`.split($RS)
45
45
  s.executables = s.files.grep(%r{^bin/}) { |f| File.basename(f) }
46
- s.test_files = s.files.grep(%r{^(test|spec|features)/})
46
+ s.test_files = s.files.grep(%r{^(test|features)/})
47
47
  s.rdoc_options = ['--charset=UTF-8']
48
48
  s.extra_rdoc_files = ['README.md', 'LICENSE.txt']
49
49
  s.add_development_dependency 'rake', '12.0.0'
data/lib/glogin/cookie.rb CHANGED
@@ -36,7 +36,9 @@ module GLogin
36
36
  # Closed
37
37
  class Closed
38
38
  def initialize(text, secret)
39
+ raise 'Text can\'t be nil' if text.nil?
39
40
  @text = text
41
+ raise 'Secret can\'t be nil' if secret.nil?
40
42
  @secret = secret
41
43
  end
42
44
 
@@ -60,7 +62,9 @@ module GLogin
60
62
  # Open
61
63
  class Open
62
64
  def initialize(json, secret)
65
+ raise 'JSON can\'t be nil' if json.nil?
63
66
  @json = json
67
+ raise 'Secret can\'t be nil' if secret.nil?
64
68
  @secret = secret
65
69
  end
66
70
 
@@ -25,5 +25,5 @@
25
25
  # Copyright:: Copyright (c) 2017-2018 Yegor Bugayenko
26
26
  # License:: MIT
27
27
  module GLogin
28
- VERSION = '0.2.2'.freeze
28
+ VERSION = '0.2.3'.freeze
29
29
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glogin
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-05 00:00:00.000000000 Z
11
+ date: 2018-06-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -148,9 +148,9 @@ require_paths:
148
148
  - lib
149
149
  required_ruby_version: !ruby/object:Gem::Requirement
150
150
  requirements:
151
- - - ">="
151
+ - - "~>"
152
152
  - !ruby/object:Gem::Version
153
- version: 1.9.3
153
+ version: '2.0'
154
154
  required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  requirements:
156
156
  - - ">="