simple_response 0.4.0 → 0.5.0
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.
- checksums.yaml +4 -4
- data/lib/simple_response/response.rb +18 -0
- data/lib/simple_response/version.rb +1 -1
- data/lib/simple_response.rb +2 -2
- data/simple_response.gemspec +6 -6
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00a4c66d5cb1aa579d9a927d8d721d4068131623
|
4
|
+
data.tar.gz: 4c44f3771dde17e78e78386e2210bf4d806820ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5dc3e1810ad210658789b3b3b22815f6bd4ef84940093e2472d919b99844c893db0c51ccd796337b2e114f98c7ca7ead82a97e82bbc8a216a835e03e98fce5e9
|
7
|
+
data.tar.gz: e815e7190453944f818ef57a81c9b52974770f53cb2271968134beb93e9e38140a5fad41b2193576ebf5b20131cc27af8ec707dbd145ef3e8c32453bbc3bb3a4
|
@@ -14,5 +14,23 @@ module SimpleResponse
|
|
14
14
|
def failure?
|
15
15
|
!success?
|
16
16
|
end
|
17
|
+
|
18
|
+
def method_missing(name, *args, &block)
|
19
|
+
if existing_query_method?(name)
|
20
|
+
send(name[0...-1])
|
21
|
+
else
|
22
|
+
super
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def respond_to_missing?(name, include_private = false)
|
27
|
+
existing_query_method?(name)
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def existing_query_method?(name)
|
33
|
+
name[-1] == '?' && respond_to?(name[0...-1])
|
34
|
+
end
|
17
35
|
end
|
18
36
|
end
|
data/lib/simple_response.rb
CHANGED
@@ -8,11 +8,11 @@ module SimpleResponse
|
|
8
8
|
end
|
9
9
|
end
|
10
10
|
|
11
|
-
def self.success(attributes)
|
11
|
+
def self.success(attributes = {})
|
12
12
|
new(success: true, **attributes)
|
13
13
|
end
|
14
14
|
|
15
|
-
def self.failure(attributes)
|
15
|
+
def self.failure(attributes = {})
|
16
16
|
new(success: false, **attributes)
|
17
17
|
end
|
18
18
|
end
|
data/simple_response.gemspec
CHANGED
@@ -16,12 +16,12 @@ Gem::Specification.new do |spec|
|
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
18
|
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
21
|
+
else
|
22
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
23
|
+
"public gem pushes."
|
24
|
+
end
|
25
25
|
|
26
26
|
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
27
27
|
f.match(%r{^(test|spec|features)/})
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple_response
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Giovanni Benussi
|
@@ -77,7 +77,8 @@ files:
|
|
77
77
|
homepage: https://github.com/giovannibenussi/simple-response
|
78
78
|
licenses:
|
79
79
|
- MIT
|
80
|
-
metadata:
|
80
|
+
metadata:
|
81
|
+
allowed_push_host: https://rubygems.org
|
81
82
|
post_install_message:
|
82
83
|
rdoc_options: []
|
83
84
|
require_paths:
|