caren-api 0.3.4 → 0.3.5
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/caren-api.gemspec +1 -3
- data/init.rb +1 -2
- data/lib/caren/caren.rb +29 -11
- data/spec/spec_helper.rb +4 -2
- metadata +2 -4
- data/certs/example +0 -15
- data/certs/example.pub +0 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.5
|
data/caren-api.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{caren-api}
|
8
|
-
s.version = "0.3.
|
8
|
+
s.version = "0.3.5"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andre Foeken"]
|
@@ -26,8 +26,6 @@ Gem::Specification.new do |s|
|
|
26
26
|
"VERSION",
|
27
27
|
"caren-api.gemspec",
|
28
28
|
"certs/caren-api.pub",
|
29
|
-
"certs/example",
|
30
|
-
"certs/example.pub",
|
31
29
|
"init.rb",
|
32
30
|
"lib/caren-api.rb",
|
33
31
|
"lib/caren/base.rb",
|
data/init.rb
CHANGED
data/lib/caren/caren.rb
CHANGED
@@ -19,25 +19,43 @@ module Caren
|
|
19
19
|
end
|
20
20
|
|
21
21
|
class Api
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
22
|
+
|
23
|
+
def self.url= url
|
24
|
+
Thread.current[:url] = url
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.url
|
28
|
+
Thread.current[:url]
|
29
|
+
end
|
30
|
+
|
31
|
+
def self.caren_public_key= key
|
32
|
+
Thread.current[:caren_public_key] = key
|
31
33
|
end
|
32
34
|
|
33
35
|
# The public key file used to verify request coming from Caren
|
34
36
|
def self.caren_public_key
|
35
|
-
|
37
|
+
Thread.current[:caren_public_key]
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.private_key= key
|
41
|
+
Thread.current[:private_key] = key
|
36
42
|
end
|
37
43
|
|
38
44
|
# The private key file used to sign requests coming from you
|
39
45
|
def self.private_key
|
40
|
-
|
46
|
+
Thread.current[:private_key]
|
47
|
+
end
|
48
|
+
|
49
|
+
def self.key_from_string string
|
50
|
+
OpenSSL::PKey::RSA.new(string)
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.key_from_path path
|
54
|
+
self.key_from_string( File.read(path) )
|
55
|
+
end
|
56
|
+
|
57
|
+
def self.generate_private_key
|
58
|
+
OpenSSL::PKey::RSA.generate( 1024 )
|
41
59
|
end
|
42
60
|
|
43
61
|
def self.put url, xml
|
data/spec/spec_helper.rb
CHANGED
@@ -5,8 +5,10 @@ require 'fakeweb'
|
|
5
5
|
require 'capybara'
|
6
6
|
|
7
7
|
# For the tests we need to know both the public and private key, so we share them here.
|
8
|
-
Caren::Api.
|
9
|
-
|
8
|
+
new_private_key = Caren::Api.generate_private_key
|
9
|
+
|
10
|
+
Caren::Api.caren_public_key = new_private_key.public_key
|
11
|
+
Caren::Api.private_key = new_private_key
|
10
12
|
Caren::Api.url = "http://example.com"
|
11
13
|
|
12
14
|
FakeWeb.allow_net_connect = false
|
metadata
CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 3
|
8
|
-
-
|
8
|
+
- 5
|
9
9
|
segments_generated: true
|
10
|
-
version: 0.3.
|
10
|
+
version: 0.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Andre Foeken
|
@@ -167,8 +167,6 @@ files:
|
|
167
167
|
- VERSION
|
168
168
|
- caren-api.gemspec
|
169
169
|
- certs/caren-api.pub
|
170
|
-
- certs/example
|
171
|
-
- certs/example.pub
|
172
170
|
- init.rb
|
173
171
|
- lib/caren-api.rb
|
174
172
|
- lib/caren/base.rb
|
data/certs/example
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
-----BEGIN RSA PRIVATE KEY-----
|
2
|
-
MIICXQIBAAKBgQDCbPwFkQhkA21mF96N0LSK0YtlyyCnkRcXMRgj9cxGZ88c5qti
|
3
|
-
VTD5As6YdEn4GHaHfEr/dMlJpT8eTYHmy4eb35gw+jiGYm24LqJqsQFK7rAJ1I0b
|
4
|
-
iE356NF8YaEOKP327K0QzTnftHijTrzDVm/6cHkXQxzAEpPaofU4TW0ljwIDAQAB
|
5
|
-
AoGBALoQDkdNepgr53/yi9tvxbervRmXgRKbeVuKci3HxswCAGUKIy2hlZJYK1oe
|
6
|
-
v8MbtiMGwcci/pbp+zOGvTAfyw+lZRP2aYIedRnRRLlmNtSYqD9BiD+F+ZfHUsHY
|
7
|
-
kFGZdQIF8FPs6utjdbqqfi3YnAkyYvEC/1ecoGb8JkqIkwRxAkEA93/E+CaXxure
|
8
|
-
/AteMIbm7CxEzasCPCvK7JQjRGgJbdRg5geB2Tjs6GjsCB1QI93KE0ZnK4M4bevI
|
9
|
-
gxzJaffIpQJBAMkajAs5OI+cpOBGZg1KMJ1GgLL21HH/47rt40KWJbZxAsbOd2Vy
|
10
|
-
4rBdu/X40JGYT/adVJh76Pw11P1gwMolKyMCQDCK+OELAL3dFzssJ58w9l3gGOaV
|
11
|
-
4exXUoewTnJ+TUsjWpYDZu5qAd1bpt+4kB1YxOee6WFZbVnx4vQEU2TbWpkCQQCe
|
12
|
-
sK8f0Ch80swcGhE/nXKdONwn3LSpvJX0lPGHQrpBrA3X2WbIDA8rwtumbpAOw9Ud
|
13
|
-
surlZKnmE4id5LJdEVVnAkAsUiPowyInJKUNEN6PbvyVsjkgZq6ykDTyTJdWcR2o
|
14
|
-
cT4sb4UzePHAAeh8g6VZeipCmO4SaugphkrPYvifWd7l
|
15
|
-
-----END RSA PRIVATE KEY-----
|
data/certs/example.pub
DELETED
@@ -1,6 +0,0 @@
|
|
1
|
-
-----BEGIN PUBLIC KEY-----
|
2
|
-
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCbPwFkQhkA21mF96N0LSK0Ytl
|
3
|
-
yyCnkRcXMRgj9cxGZ88c5qtiVTD5As6YdEn4GHaHfEr/dMlJpT8eTYHmy4eb35gw
|
4
|
-
+jiGYm24LqJqsQFK7rAJ1I0biE356NF8YaEOKP327K0QzTnftHijTrzDVm/6cHkX
|
5
|
-
QxzAEpPaofU4TW0ljwIDAQAB
|
6
|
-
-----END PUBLIC KEY-----
|