authy 1.1.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'httpclient'
3
+ gem 'httpclient', ">= 2.2.6"
4
4
 
5
5
  group :development do
6
6
  gem "rspec"
@@ -49,7 +49,7 @@ PLATFORMS
49
49
  ruby
50
50
 
51
51
  DEPENDENCIES
52
- httpclient
52
+ httpclient (>= 2.2.6)
53
53
  jeweler
54
54
  pry
55
55
  rdoc
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.0
1
+ 2.0.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "authy"
8
- s.version = "1.1.0"
8
+ s.version = "2.0.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Authy", "David A. Cuadrado"]
12
- s.date = "2013-02-04"
12
+ s.date = "2013-04-09"
13
13
  s.description = "Ruby library to access Authy services"
14
14
  s.email = "krawek@gmail.com"
15
15
  s.executables = ["authy-api-console"]
@@ -32,6 +32,7 @@ Gem::Specification.new do |s|
32
32
  "lib/authy.rb",
33
33
  "lib/authy/api.rb",
34
34
  "lib/authy/config.rb",
35
+ "lib/authy/core_ext.rb",
35
36
  "lib/authy/models/user.rb",
36
37
  "lib/authy/response.rb",
37
38
  "spec/authy/api_spec.rb",
@@ -48,7 +49,7 @@ Gem::Specification.new do |s|
48
49
  s.specification_version = 3
49
50
 
50
51
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
51
- s.add_runtime_dependency(%q<httpclient>, [">= 0"])
52
+ s.add_runtime_dependency(%q<httpclient>, [">= 2.2.6"])
52
53
  s.add_development_dependency(%q<rspec>, [">= 0"])
53
54
  s.add_development_dependency(%q<pry>, [">= 0"])
54
55
  s.add_development_dependency(%q<yard>, [">= 0"])
@@ -57,7 +58,7 @@ Gem::Specification.new do |s|
57
58
  s.add_development_dependency(%q<simplecov>, [">= 0"])
58
59
  s.add_development_dependency(%q<reek>, [">= 0"])
59
60
  else
60
- s.add_dependency(%q<httpclient>, [">= 0"])
61
+ s.add_dependency(%q<httpclient>, [">= 2.2.6"])
61
62
  s.add_dependency(%q<rspec>, [">= 0"])
62
63
  s.add_dependency(%q<pry>, [">= 0"])
63
64
  s.add_dependency(%q<yard>, [">= 0"])
@@ -67,7 +68,7 @@ Gem::Specification.new do |s|
67
68
  s.add_dependency(%q<reek>, [">= 0"])
68
69
  end
69
70
  else
70
- s.add_dependency(%q<httpclient>, [">= 0"])
71
+ s.add_dependency(%q<httpclient>, [">= 2.2.6"])
71
72
  s.add_dependency(%q<rspec>, [">= 0"])
72
73
  s.add_dependency(%q<pry>, [">= 0"])
73
74
  s.add_dependency(%q<yard>, [">= 0"])
@@ -4,6 +4,7 @@ require 'httpclient'
4
4
  require 'httpclient/include_client'
5
5
  require 'json'
6
6
 
7
+ require 'authy/core_ext'
7
8
  require 'authy/response'
8
9
  require 'authy/models/user'
9
10
  require 'authy/config'
@@ -54,7 +54,7 @@ module Authy
54
54
  def self.escape_for_url(field)
55
55
  URI.escape(field.to_s.strip, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]"))
56
56
  end
57
-
57
+
58
58
  # Copied and extended from httpclient's HTTP::Message#escape_query()
59
59
  def self.escape_query(query, namespace = nil) # :nodoc:
60
60
  pairs = []
@@ -0,0 +1,26 @@
1
+ class Hash
2
+ def self.try_convert(value)
3
+ return value if value.instance_of?(Hash)
4
+ return nil if !value.respond_to?(:to_hash)
5
+ converted = value.to_hash
6
+ return converted if converted.instance_of?(Hash)
7
+
8
+ cname = value.class.name
9
+ raise TypeError, "can't convert %s to %s (%s#%s gives %s)" %
10
+ [cname, Hash.name, cname, :to_hash, converted.class.name]
11
+ end unless Hash.respond_to?(:try_convert)
12
+ end
13
+
14
+ class Array
15
+ def self.try_convert(value)
16
+ return value if value.instance_of?(Array)
17
+ return nil if !value.respond_to?(:to_ary)
18
+ converted = value.to_ary
19
+ return converted if converted.instance_of?(Array)
20
+
21
+ cname = value.class.name
22
+ raise TypeError, "can't convert %s to %s (%s#%s gives %s)" %
23
+ [cname, Array.name, cname, :to_ary, converted.class.name]
24
+ end unless Array.respond_to?(:try_convert)
25
+ end
26
+
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: authy
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.1.0
5
+ version: 2.0.1
6
6
  platform: ruby
7
7
  authors:
8
8
  - Authy
@@ -10,25 +10,26 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-02-04 00:00:00.000000000 Z
13
+ date: 2013-04-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
+ type: :runtime
16
17
  version_requirements: !ruby/object:Gem::Requirement
17
18
  none: false
18
19
  requirements:
19
20
  - - ! '>='
20
21
  - !ruby/object:Gem::Version
21
- version: '0'
22
+ version: 2.2.6
22
23
  name: httpclient
23
- type: :runtime
24
24
  prerelease: false
25
25
  requirement: !ruby/object:Gem::Requirement
26
26
  none: false
27
27
  requirements:
28
28
  - - ! '>='
29
29
  - !ruby/object:Gem::Version
30
- version: '0'
30
+ version: 2.2.6
31
31
  - !ruby/object:Gem::Dependency
32
+ type: :development
32
33
  version_requirements: !ruby/object:Gem::Requirement
33
34
  none: false
34
35
  requirements:
@@ -36,7 +37,6 @@ dependencies:
36
37
  - !ruby/object:Gem::Version
37
38
  version: '0'
38
39
  name: rspec
39
- type: :development
40
40
  prerelease: false
41
41
  requirement: !ruby/object:Gem::Requirement
42
42
  none: false
@@ -45,6 +45,7 @@ dependencies:
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
47
  - !ruby/object:Gem::Dependency
48
+ type: :development
48
49
  version_requirements: !ruby/object:Gem::Requirement
49
50
  none: false
50
51
  requirements:
@@ -52,7 +53,6 @@ dependencies:
52
53
  - !ruby/object:Gem::Version
53
54
  version: '0'
54
55
  name: pry
55
- type: :development
56
56
  prerelease: false
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  none: false
@@ -61,6 +61,7 @@ dependencies:
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  - !ruby/object:Gem::Dependency
64
+ type: :development
64
65
  version_requirements: !ruby/object:Gem::Requirement
65
66
  none: false
66
67
  requirements:
@@ -68,7 +69,6 @@ dependencies:
68
69
  - !ruby/object:Gem::Version
69
70
  version: '0'
70
71
  name: yard
71
- type: :development
72
72
  prerelease: false
73
73
  requirement: !ruby/object:Gem::Requirement
74
74
  none: false
@@ -77,6 +77,7 @@ dependencies:
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0'
79
79
  - !ruby/object:Gem::Dependency
80
+ type: :development
80
81
  version_requirements: !ruby/object:Gem::Requirement
81
82
  none: false
82
83
  requirements:
@@ -84,7 +85,6 @@ dependencies:
84
85
  - !ruby/object:Gem::Version
85
86
  version: '0'
86
87
  name: rdoc
87
- type: :development
88
88
  prerelease: false
89
89
  requirement: !ruby/object:Gem::Requirement
90
90
  none: false
@@ -93,6 +93,7 @@ dependencies:
93
93
  - !ruby/object:Gem::Version
94
94
  version: '0'
95
95
  - !ruby/object:Gem::Dependency
96
+ type: :development
96
97
  version_requirements: !ruby/object:Gem::Requirement
97
98
  none: false
98
99
  requirements:
@@ -100,7 +101,6 @@ dependencies:
100
101
  - !ruby/object:Gem::Version
101
102
  version: '0'
102
103
  name: jeweler
103
- type: :development
104
104
  prerelease: false
105
105
  requirement: !ruby/object:Gem::Requirement
106
106
  none: false
@@ -109,6 +109,7 @@ dependencies:
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
+ type: :development
112
113
  version_requirements: !ruby/object:Gem::Requirement
113
114
  none: false
114
115
  requirements:
@@ -116,7 +117,6 @@ dependencies:
116
117
  - !ruby/object:Gem::Version
117
118
  version: '0'
118
119
  name: simplecov
119
- type: :development
120
120
  prerelease: false
121
121
  requirement: !ruby/object:Gem::Requirement
122
122
  none: false
@@ -125,6 +125,7 @@ dependencies:
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
+ type: :development
128
129
  version_requirements: !ruby/object:Gem::Requirement
129
130
  none: false
130
131
  requirements:
@@ -132,7 +133,6 @@ dependencies:
132
133
  - !ruby/object:Gem::Version
133
134
  version: '0'
134
135
  name: reek
135
- type: :development
136
136
  prerelease: false
137
137
  requirement: !ruby/object:Gem::Requirement
138
138
  none: false
@@ -163,6 +163,7 @@ files:
163
163
  - lib/authy.rb
164
164
  - lib/authy/api.rb
165
165
  - lib/authy/config.rb
166
+ - lib/authy/core_ext.rb
166
167
  - lib/authy/models/user.rb
167
168
  - lib/authy/response.rb
168
169
  - spec/authy/api_spec.rb
@@ -182,7 +183,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
182
183
  - !ruby/object:Gem::Version
183
184
  segments:
184
185
  - 0
185
- hash: -2890998156297207065
186
+ hash: -4420740530967124060
186
187
  version: '0'
187
188
  required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  none: false