authbox 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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/authbox.rb +9 -6
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e141dfb9225bbe2ab57222f2a20c8ccffc55470a
4
- data.tar.gz: b344c19419a40d1dc730b638c35c19fd79ad8ec9
3
+ metadata.gz: ddf5c8f090baec72a6aa598fbb2e4598ec1bd238
4
+ data.tar.gz: 5648ec3da5624749cdcb19cef90449361d227410
5
5
  SHA512:
6
- metadata.gz: df7933e149fe281b4be2b2044c9cb3e5f3555d10471da2bd9561c3e3fa2d7a600bfabde2ce6ccb0ada9ab18b16f7d022c7408720e6b534f24a9d7d30a1437f32
7
- data.tar.gz: cfc3346953eede700e6f5ed4f5764ac24982b5e893eb22cd09e0e7b8f919594df2ccccafda980e2081c6003e189f80e7b5a80e955c338d510722e7eb5c690e5d
6
+ metadata.gz: 1d349e8cf24f32a879603858da81e19654b96d7fd6f172115d48ae65b3c3de8f8d4c2d374a6a2a2b9c0a2fbbb7f37b3614ad7f7bd5aae608bf6eb02fc95949fe
7
+ data.tar.gz: ffbaa80f215f50e92d415db7f9d67b1ad94c656f4ac72ba838882e9b1ceef186411607c4ae5e452138121706c62c8ed7de89106feb42bad963eff0c28f0bea8d
data/lib/authbox.rb CHANGED
@@ -53,9 +53,9 @@ module Authbox
53
53
  # Report a custom action to Authbox.
54
54
  # If this is not called during a request, an $unknown action
55
55
  # will be logged. See the documentation for what information
56
- # you can pass here in the features hash.
57
- def authbox_log(features={})
58
- return authbox_request(features, true)
56
+ # you can pass here in the action hash.
57
+ def authbox_log(action={})
58
+ return authbox_request(action, true)
59
59
  end
60
60
 
61
61
  ##
@@ -100,7 +100,7 @@ module Authbox
100
100
  return Rails.configuration.authbox[:endpoint] || 'https://api.authbox.io/api'
101
101
  end
102
102
 
103
- def authbox_request(features, async)
103
+ def authbox_request(action, async)
104
104
  if @authbox_requested
105
105
  logger.warn 'authbox_log() already called'
106
106
  return
@@ -140,7 +140,7 @@ module Authbox
140
140
  }
141
141
 
142
142
  body.merge!(authbox_get_request_data())
143
- body.merge!(features)
143
+ body.merge!(action)
144
144
 
145
145
  base_uri = authbox_get_endpoint()
146
146
  uri = URI(base_uri + '/action')
@@ -155,7 +155,10 @@ module Authbox
155
155
  response = authbox_post_form(uri, body)
156
156
 
157
157
  begin
158
- return JSON.parse(response.body)
158
+ parsed_response = JSON.parse(response.body)
159
+ if not parsed_response.has_key? 'type'
160
+ return {'type' => 'ALLOW', 'info' => 'No verdict returend'}
161
+ end
159
162
  rescue => e
160
163
  logger.warn "AUTHBOX: Error decoding body: #{e}"
161
164
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Authbox, Inc.
@@ -77,7 +77,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
77
77
  version: '0'
78
78
  requirements: []
79
79
  rubyforge_project:
80
- rubygems_version: 2.2.2
80
+ rubygems_version: 2.4.3
81
81
  signing_key:
82
82
  specification_version: 4
83
83
  summary: Authbox