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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 440fcbf52195296c33844d17a67c26f1f6765942
4
- data.tar.gz: 1c5a31a5dd7877c8f2654228ad5986e4000a8376
3
+ metadata.gz: 00a4c66d5cb1aa579d9a927d8d721d4068131623
4
+ data.tar.gz: 4c44f3771dde17e78e78386e2210bf4d806820ed
5
5
  SHA512:
6
- metadata.gz: b70b09f020cab8a1fb78e8c79f2aa366fb18a52c71d6afe1097fd24ab3be4b328b68de42cc1ad022553b036565dadd2854393589a4fc6b21a608d31abf6cba53
7
- data.tar.gz: eb4ce9dd2eeb2e7d012ad558722733ef2256dfbdfbcc1d4deedde88919c5dfa9af39b7f7b57497795812ba7e3a9c62665a0c23fb3c1d4e3025214416a813e4e1
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
@@ -1,3 +1,3 @@
1
1
  module SimpleResponse
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -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
@@ -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
- # 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
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.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: