simple_response 0.9.0 → 0.10.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
  SHA256:
3
- metadata.gz: 524eaf193eb0ad323b1708023c06cea7984c887b243dfdd903187a1d505ad10f
4
- data.tar.gz: 4c30389d75711518736fd8f76ab84bca9426c8019a23db72f6ceb630055cfa25
3
+ metadata.gz: 13876aa28d3ca6144893bb11b5c1bf3e85b9b0d2ef6491dd03d7279643349aae
4
+ data.tar.gz: 4f38843421372ef7c349298c84ef5c84c3099fafc59b5e1e1d497bbc76e7a6ef
5
5
  SHA512:
6
- metadata.gz: 201f79248a04ac74cdcc48287138520aa06c0d6583dbf1fb935c582cf2096c34b05599d846dd17e1787547c240d78c867a219057c731d8dacb1734f55704d222
7
- data.tar.gz: 1013600ccc6a65fd1ebe12a3741318e4e72a624eca01a673855c45817440daad826e85a52c3fa58147bd18cfb1d7c89cd092d15aa620f58f09a1f45a554c073b
6
+ metadata.gz: e7abf84566c51a0e6961649796d27797856af8ef5495c09b0d4cef3c015d4e286ab8fa4ead1f44acb76e841a3d1f98a6c4932caf95f5ce9ad693ca325c9c09f1
7
+ data.tar.gz: cd236e89b8d3678b1141322af46f31451d68d7add77cde5530cda50d9b13b11e58391fba65ebeae15011c98fea1d45c89dd1347ac20294d9d2c5c64ad058fc9d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- simple_response (0.8.1)
4
+ simple_response (0.9.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -40,4 +40,4 @@ DEPENDENCIES
40
40
  simplecov
41
41
 
42
42
  BUNDLED WITH
43
- 1.16.0
43
+ 1.16.1
@@ -1,11 +1,10 @@
1
1
  module SimpleResponse
2
- require 'ostruct'
3
2
  require 'simple_response/query_methods'
4
3
  require 'simple_response/simple_struct'
5
4
 
6
5
  class Response < SimpleStruct
7
- def initialize(success:)
8
- super
6
+ def initialize(success:, **attributes)
7
+ super(attributes)
9
8
  @success = success
10
9
  end
11
10
 
@@ -1,11 +1,19 @@
1
1
  module SimpleResponse
2
+ # SimpleStruct class is an OpenStruct-like class that allows
3
+ # to assign and read arbitrary values.
2
4
  class SimpleStruct
3
5
  include SimpleResponse::QueryMethods
4
6
 
5
- def initialize(*args)
6
- @attributes = {}
7
+ def initialize(**args)
8
+ @attributes = args.dup
7
9
  end
8
10
 
11
+ def keys
12
+ @attributes.keys
13
+ end
14
+
15
+ private
16
+
9
17
  def method_missing(name, *args, &block)
10
18
  if existing_query_method?(name)
11
19
  query_method(name)
@@ -27,9 +35,5 @@ module SimpleResponse
27
35
  def write_method?(name)
28
36
  name[-1] == '='
29
37
  end
30
-
31
- def keys
32
- @attributes.keys
33
- end
34
38
  end
35
39
  end
@@ -1,3 +1,3 @@
1
1
  module SimpleResponse
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
@@ -3,9 +3,7 @@ require "simple_response/response"
3
3
 
4
4
  module SimpleResponse
5
5
  def self.new(success: true, **attributes)
6
- SimpleResponse::Response.new(success: success).tap do |response|
7
- attributes.each { |k, v| response.send("#{k}=", v) }
8
- end
6
+ SimpleResponse::Response.new(success: success, **attributes)
9
7
  end
10
8
 
11
9
  def self.success(attributes = {})
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.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Giovanni Benussi