stellar_federation-rails 0.2.0 → 0.2.1
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ecc4193c8f6e90947bea679d94937d89157f7668e7821993afb5d8c55c995c7a
|
4
|
+
data.tar.gz: 2ac13719436f6723cd241349c36ae2076f7667313cdf6e2029e56709bbf8efd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84e08b2c6474f8cce54f1dad5ab20aefb782adf74b689b994840cfa02839820e5f00b86cf57bf6987aaef0ea84189c9b1a1c3720e58e94b1386d5714fcd587fc
|
7
|
+
data.tar.gz: c1f597fd7b8222dd43eaf7ca99b81d72352d4f4e10e2c09efb66c9c6bdadec96fe320bb7433b98f2d7117caa6c3185a3512cc51de2775f8614721794cd17d4f8
|
data/README.md
CHANGED
@@ -47,7 +47,11 @@ StellarFederation.configure do |c|
|
|
47
47
|
end
|
48
48
|
```
|
49
49
|
|
50
|
-
`c.on_query`
|
50
|
+
- `c.on_query` contains a class the you define
|
51
|
+
- The `on_query` class should also return a `StellarFederation::QueryResponse`.
|
52
|
+
- You can return nothing if you don't find a record
|
53
|
+
- If you return something and it's not a `StellarFederation::QueryResponse`, the Rails engine will throw an exception.
|
54
|
+
- The `on_query` class will be called with `.call`, that accepts a `StellarFederation::Query` object:
|
51
55
|
- `address_name` - ex: `tunder_adebayo*your_org.com`
|
52
56
|
- `address_id` - ex: `tunder_adebayo`
|
53
57
|
- `address_domain` - ex: `your_org.com`
|
@@ -10,12 +10,13 @@ module StellarFederation
|
|
10
10
|
if result.success?
|
11
11
|
@query_response = result.query_response
|
12
12
|
|
13
|
-
|
13
|
+
if @query_response.present?
|
14
|
+
render json: @query_response.to_json, status: :ok
|
15
|
+
else
|
16
|
+
render json: @query_response.to_json, status: :not_found
|
17
|
+
end
|
14
18
|
else
|
15
|
-
json_status = {
|
16
|
-
status: "Unprocessable Entity",
|
17
|
-
message: result.message,
|
18
|
-
}
|
19
|
+
json_status = { details: result.message }
|
19
20
|
|
20
21
|
render json: json_status, status: :unprocessable_entity
|
21
22
|
end
|
@@ -9,8 +9,10 @@ module StellarFederation
|
|
9
9
|
begin
|
10
10
|
c.query_response = callback_class.(c.query)
|
11
11
|
|
12
|
-
if
|
13
|
-
|
12
|
+
if c.query_response.present?
|
13
|
+
if !c.query_response.is_a? StellarFederation::QueryResponse
|
14
|
+
raise_return_error
|
15
|
+
end
|
14
16
|
end
|
15
17
|
rescue NameError => e
|
16
18
|
raise NameError, "StellarFederation.on_query isn't configured"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stellar_federation-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ace Subido
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-04-
|
11
|
+
date: 2018-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|