remotr 1.1.1 → 1.1.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/remotr/respondable.rb +5 -3
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53fe2ebc522cbabbc2b9d7df0d82d1560d705af1
4
- data.tar.gz: 4682d5e4a7542adcef81172d567f4ecccab8d482
3
+ metadata.gz: 37c4b0c5d782242eee389fa51b0a4994e2227772
4
+ data.tar.gz: 8e7531229eb96f19bd8ae930c75e6969d27c2d01
5
5
  SHA512:
6
- metadata.gz: 9f840c0ecf76356d6213639a835bfb888af05e20929168315c1c4e04016bfb23a0d61f076fc3b9b48a5be6cf5a5f1b214c458343e763294fb8f61e721d2af20c
7
- data.tar.gz: 7abc649f75911020f79fb2337714cfd8c42e64ec81a0c25f2172a9102cd8e517243f32da8e4a9efa49134426557c7bf65e0d207016d300b157afa2e6136d64df
6
+ metadata.gz: eb1a347376a2c2227400b2cd5ce3f0352d242e407a0781566dbab8481c1f9ff719ce4317a22a984b563f59577ca8745f82bd93f7c2b38c57c00d1751c32a544a
7
+ data.tar.gz: 60301926d51b5b470bbcb1db3cf9fe070bf6de5374fb298d08ed117880003885b2e2e40fb8b8277acf97424a17c16e49129f27c373d8554bde10b8d8a14d94da
@@ -65,11 +65,13 @@ module Remotr
65
65
  return Operations.failure(:response_is_not_json, object: httparty_response) unless httparty_response.content_type == 'application/json'
66
66
  parsed_response = httparty_response.parsed_response
67
67
  return Operations.failure(:response_missing_success_flag, object: httparty_response) unless parsed_response && parsed_response.key?('success')
68
- return Operations.failure(:response_unsuccessful, object: httparty_response) if parsed_response['success'].to_s != 'true'
69
68
 
70
- object = parsed_response[namespace_to_use.to_s]
71
- code = parsed_response['code'].to_s != '' ? parsed_response['code'].to_sym : :request_succeeded
69
+ code = parsed_response['code'].to_s != '' ? parsed_response['code'].to_sym : :response_unsuccessful
70
+ message = parsed_response['message'].to_s != '' ? parsed_response['message'] : code.to_s
71
+ return Operations.failure(code, object: httparty_response, message: message) if parsed_response['success'].to_s != 'true'
72
72
 
73
+ code = parsed_response['code'].to_s != '' ? parsed_response['code'].to_sym : :request_succeeded
74
+ object = parsed_response[namespace_to_use.to_s]
73
75
  Operations.success code, object: object
74
76
 
75
77
  rescue JSON::ParserError
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: remotr
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - bukowskis