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: e2a5dd9c599f9a33cd232b074bebb2c94f7cb429d824cc0a7b559e4a11736bd6
4
- data.tar.gz: 4011c7b3bd8dc0d51ed2f1ba0d36c3721109f18e2e05ae48a6901e5a56d4e850
3
+ metadata.gz: ecc4193c8f6e90947bea679d94937d89157f7668e7821993afb5d8c55c995c7a
4
+ data.tar.gz: 2ac13719436f6723cd241349c36ae2076f7667313cdf6e2029e56709bbf8efd0
5
5
  SHA512:
6
- metadata.gz: 3e5192333665c01abf43ec5e33de7363df91ea03552ef3df2f4d41737e1a14507ec8f837e6f92eafbff59a34bb9800cedac7669174b4aa3e978fd2027730c980
7
- data.tar.gz: c68aa010040e7bcb817242af6f541d168cf0b44c745f8933ded7513cd73ec86292b9b37676d51ea2a3811cc8cd8c3572194158814e18596ea29298dd3e9a875d
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` - is a class the you define: The `on_query` class should also return a `StellarFederation::QueryResponse`. If it doesn't, the Rails engine will throw an exception. The `on_query` class will be called with `.call`, that accepts a `StellarFederation::Query` object
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
- render json: @query_response.to_json, status: :ok
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 !c.query_response.is_a? StellarFederation::QueryResponse
13
- raise_return_error
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"
@@ -1,3 +1,3 @@
1
1
  module StellarFederation
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
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.0
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-24 00:00:00.000000000 Z
11
+ date: 2018-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails