bjond-api 0.2.6 → 0.3.0
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/app/controllers/bjondservices_controller.rb +4 -4
- data/app/models/bjond_registration.rb +5 -4
- data/bjond-api.gemspec +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 126a780198d0298c600708c72ed453bcdd604d87
|
4
|
+
data.tar.gz: 16dbe25901838404c208122dd66f934bb9162396
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 86e1b2a93ef623f6c37a67c6634a1bb9e3fd96d0909870ab124b16091a63bb02cb19a6e40b44a094c80ffbe66a88ba9d0a58f5b090ce2ffbbd3aaa667fe67ab6
|
7
|
+
data.tar.gz: 804ca8e30ad6e0206cbf601bc1457e96f359a8a72547628ce7fc52db35847b4f162515836ed96991c082575a0083314d2ebef4f5c8090126a23617fa63809311
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
@@ -32,7 +32,7 @@ class BjondservicesController < ApplicationController
|
|
32
32
|
|
33
33
|
|
34
34
|
def register_group_endpoint
|
35
|
-
registration = BjondRegistration.
|
35
|
+
registration = BjondRegistration.find_registration_by_remote_request(request)
|
36
36
|
service = BjondService.find_or_initialize_by(:group_id => params[:groupid], :bjond_registration_id => registration.id)
|
37
37
|
if (service.endpoint != params[:endpoint])
|
38
38
|
service.endpoint = params[:endpoint]
|
@@ -44,7 +44,7 @@ class BjondservicesController < ApplicationController
|
|
44
44
|
################ Encrypted Communication w Bjond servers ################
|
45
45
|
def configure_group_endpoint
|
46
46
|
puts 'configure_group_endpoint'
|
47
|
-
bjond_registration = BjondRegistration.
|
47
|
+
bjond_registration = BjondRegistration.find_registration_by_remote_request(request)
|
48
48
|
result = jwt_decode_payload_and_return_json(request.raw_post, bjond_registration)
|
49
49
|
BjondApi::BjondAppConfig.instance.configure_group(result, bjond_registration)
|
50
50
|
render :json => {
|
@@ -55,11 +55,11 @@ class BjondservicesController < ApplicationController
|
|
55
55
|
def get_schema
|
56
56
|
puts 'get_schema'
|
57
57
|
render :json => jwt_encode_payload(BjondApi::BjondAppConfig.instance.group_configuration_schema,
|
58
|
-
BjondRegistration.
|
58
|
+
BjondRegistration.find_registration_by_remote_request(request))
|
59
59
|
end
|
60
60
|
|
61
61
|
def get_group_configuration
|
62
|
-
bjond_registration = BjondRegistration.
|
62
|
+
bjond_registration = BjondRegistration.find_registration_by_remote_request(request)
|
63
63
|
payload = BjondApi::BjondAppConfig.instance.get_group_configuration(bjond_registration)
|
64
64
|
render :json => jwt_encode_payload(payload.to_json, bjond_registration)
|
65
65
|
end
|
@@ -7,8 +7,8 @@ class BjondRegistration < ActiveRecord::Base
|
|
7
7
|
|
8
8
|
attr_encrypted :encryption_key, key: ENV[BjondApi::BjondAppConfig.instance.encryption_key_name]
|
9
9
|
|
10
|
-
def self.
|
11
|
-
ip = Resolv.getaddress(ip)
|
10
|
+
def self.find_registration_by_remote_request(request)
|
11
|
+
ip = Resolv.getaddress(request.ip)
|
12
12
|
result = BjondRegistration.find_by_ip(ip)
|
13
13
|
if (!result.nil?)
|
14
14
|
return result
|
@@ -19,8 +19,9 @@ class BjondRegistration < ActiveRecord::Base
|
|
19
19
|
return host_result
|
20
20
|
end
|
21
21
|
|
22
|
-
puts 'Warning! No BjondRegistration found for ip: ' + ip + '. This IP resolves to ' + host. 'Trying most recent registration. '
|
23
|
-
|
22
|
+
puts 'Warning! No BjondRegistration found for ip: ' + ip + '. This IP resolves to ' + host. + 'Trying most recent registration. '
|
23
|
+
puts 'Incoming request parameters: '
|
24
|
+
ap request
|
24
25
|
return BjondRegistration.last
|
25
26
|
end
|
26
27
|
|
data/bjond-api.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: bjond-api 0.
|
5
|
+
# stub: bjond-api 0.3.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "bjond-api".freeze
|
9
|
-
s.version = "0.
|
9
|
+
s.version = "0.3.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|