jsender 2.1.1 → 2.2.0

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
- SHA1:
3
- metadata.gz: bd70b76761e401d9b3590a18eef0c223474e340f
4
- data.tar.gz: 379b741e64fdaddd2b620ce7f9cbb7a7fec2509f
2
+ SHA256:
3
+ metadata.gz: 9a14bbcd279afde03c506cc4a5bd4be23db94f26d28d5649745b841b6e7bc840
4
+ data.tar.gz: 0e3696217fb4486c78ccf74a7e2f134180c12447ae540764fd83d8c1c677af58
5
5
  SHA512:
6
- metadata.gz: 152bbd0dfd69ec6d287d1ef2efce390d3d217135a398809003a373ef06941be0c778a521855d8941573202f6975175f603795841c821d6d1b20e778ae6a9a8c5
7
- data.tar.gz: 114cce23ec5ddd67c56a291a27334b704affdc49407fa176539bb8b6a3bc93d4d0dd820aa5f1aa5fa0abbb74e7aca5789de1993bac6e7848168e60a7123f02b4
6
+ metadata.gz: c84ea80faa3985e0d1d85f63b1e98dda0f9214a21f4bee729ac162933453e3e6722b9beacc5b508b2277ed75e435b89ce39938dba83ffb41301a7270a4d0c5fb
7
+ data.tar.gz: 364f94307b12cda69e4ba7d59f9bacd6919cbb92d18e5699734de995737f11bc69d79f8752e10c3806776879bec07e46ed3d971a88ea61b12fdfb85f4a543ad9
@@ -3,4 +3,6 @@ rvm:
3
3
  - 2.2.2
4
4
  - 2.3
5
5
  - 2.4
6
+ - 2.5
7
+ - 2.6
6
8
  before_install:
data/README.md CHANGED
@@ -64,13 +64,13 @@ Basic usage without any parameters yielding default json encoded jsend format in
64
64
 
65
65
  ```ruby
66
66
  Jsender::Rack.success
67
- => [200, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>nil}, "{\"status\":\"success\",\"data\":null}"]
67
+ => [200, {"Content-Type"=>"application/json"}, "{\"status\":\"success\",\"data\":null}"]
68
68
 
69
69
  Jsender::Rack.failure
70
- => [400, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>nil}, "{\"status\":\"fail\",\"data\":{\"message\":\"A failure has occurred\"}}"]
70
+ => [400, {"Content-Type"=>"application/json"}, "{\"status\":\"fail\",\"data\":{\"message\":\"A failure has occurred\"}}"]
71
71
 
72
72
  Jsender::Rack.error
73
- => [500, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>nil}, "{\"status\":\"error\",\"message\":\"An error has occurred\"}"]
73
+ => [500, {"Content-Type"=>"application/json"}, "{\"status\":\"error\",\"message\":\"An error has occurred\"}"]
74
74
  ```
75
75
 
76
76
  Or with parameters yielding the correct json encoded jsend format in a Rack tuple for use in controllers (including Sinatra):
@@ -79,10 +79,10 @@ Or with parameters yielding the correct json encoded jsend format in a Rack tupl
79
79
  Jsender::Rack.success(data: {'key' => 'value'}, code: 201, flow_id: '123')
80
80
  => [201, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>"123"}, "{\"status\":\"success\",\"data\":{\"key\":\"value\"}}"]
81
81
 
82
- Jsender::Rack.failure(message: 'some custom failure message', code: 201, flow_id: '123')
82
+ Jsender::Rack.failure(message: 'some custom failure message', code: 201, flow_id: '123')
83
83
  => [201, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>"123"}, "{\"status\":\"fail\",\"data\":{\"message\":\"some custom failure message\"}}"]
84
84
 
85
- Jsender::Rack.error(message: 'some custom failure message', code: 201, flow_id: '123')
85
+ Jsender::Rack.error(message: 'some custom failure message', code: 201, flow_id: '123')
86
86
  => [201, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>"123"}, "{\"status\":\"error\",\"message\":\"some custom failure message\"}"]
87
87
  ```
88
88
 
@@ -92,7 +92,7 @@ Rack middlware responses require that the body of the response tuple is in an ar
92
92
 
93
93
  ```ruby
94
94
  Jsender::Rack.error(body_as_array: true)
95
- => [500, {"Content-Type"=>"application/json", "X-Flow-Identifier"=>nil}, ["{\"status\":\"error\",\"message\":\"An error has occurred\"}"]]
95
+ => [500, {"Content-Type"=>"application/json"}, ["{\"status\":\"error\",\"message\":\"An error has occurred\"}"]]
96
96
  ```
97
97
 
98
98
  ## Development
@@ -34,10 +34,13 @@ module Jsender
34
34
  end
35
35
 
36
36
  def headers(flow_id:)
37
- {
38
- 'Content-Type' => 'application/json',
39
- 'X-Flow-Identifier' => flow_id
37
+ headers = {
38
+ 'Content-Type' => 'application/json'
40
39
  }
40
+
41
+ headers.merge!('X-Flow-Identifier' => flow_id) if flow_id
42
+
43
+ headers
41
44
  end
42
45
  end
43
46
 
@@ -1,3 +1,3 @@
1
1
  module Jsender
2
- VERSION = "2.1.1"
2
+ VERSION = "2.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsender
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ernst Van Graan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2019-09-06 00:00:00.000000000 Z
12
+ date: 2019-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -123,7 +123,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
123
123
  version: '0'
124
124
  requirements: []
125
125
  rubyforge_project:
126
- rubygems_version: 2.2.2
126
+ rubygems_version: 2.7.6
127
127
  signing_key:
128
128
  specification_version: 4
129
129
  summary: JSender facilitates a simple jsend implementation for ruby