rubytoolbox-api 0.1.0 → 0.2.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: 074f746fd6ec2589d1b6ec6b494ce814c469bc2dcc3ef47171f9ae6f184f254e
4
- data.tar.gz: cbdf7c4df218fd0ae0bffbf7ec4875f0df07f7a23187388415563b51a540d38d
3
+ metadata.gz: 7aa200befa539feb7c541d6e93ad35622d5755b170b651b9b8522aadc38ad4f0
4
+ data.tar.gz: 912b8c65a1562e1853b1092e5eb5aefe543d8c39e5353b24ba28e3654e1fa7cd
5
5
  SHA512:
6
- metadata.gz: 13acb59c9172b2d00479e2195ce1a259af0756f00f745d94935f46fb7197a6e430b61264160384e984e58735ad51569cd78a143bf8b0795d2b07e3d502d728d1
7
- data.tar.gz: c5119e50a5f4129c29151843429ecc7463c4c187351086b967369bf10238dbc505a86490822e5d7214820d6f15bd90034aee5157526249b46e726b4031fdc74b
6
+ metadata.gz: 95094f8b4071964c5f4e1080818d235db3079ad8005348a341cd650783d0fdc998d6567f868168b3dbfa69e3d166f59f226c7a31a644ce840844a66a8c32906f
7
+ data.tar.gz: cecc3df430e09ed720481c3220cdcfa31eedf2898440b01984d24e21641e36374819b40291f049a3f86457da844a69991a4dd4a83a1a71f4217c56790370e76d
@@ -0,0 +1,12 @@
1
+
2
+ ## [0.2.0] - 2020-06-30
3
+
4
+ ### Added
5
+
6
+ * [Allow to cast wrapped objects back to hashes](https://github.com/rubytoolbox/rubytoolbox-api/pull/3)
7
+
8
+ ## 0.1.0 - 2020-03-31
9
+
10
+ * Initial release
11
+
12
+ [0.2.0]: https://github.com/rubytoolbox/rubytoolbox-api/compare/v0.1.0...v0.2.0
data/README.md CHANGED
@@ -36,7 +36,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
36
36
 
37
37
  ## Contributing
38
38
 
39
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rubytoolbox-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/rubytoolbox-api/blob/master/CODE_OF_CONDUCT.md).
39
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubytoolbox/rubytoolbox-api. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/rubytoolbox/rubytoolbox-api/blob/master/CODE_OF_CONDUCT.md).
40
40
 
41
41
 
42
42
  ## License
@@ -45,4 +45,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
45
45
 
46
46
  ## Code of Conduct
47
47
 
48
- Everyone interacting in the Rubytoolbox::Api project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/rubytoolbox-api/blob/master/CODE_OF_CONDUCT.md).
48
+ Everyone interacting in the Rubytoolbox::Api project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rubytoolbox/rubytoolbox-api/blob/master/CODE_OF_CONDUCT.md).
@@ -43,6 +43,26 @@ module Rubytoolbox
43
43
  send "#{name}=", value unless value.nil?
44
44
  end
45
45
  end
46
+
47
+ def to_h
48
+ self.class.fields.each_with_object({}) do |field, hash|
49
+ value = public_send field
50
+
51
+ hash[field] = hashify(value)
52
+ end
53
+ end
54
+
55
+ private
56
+
57
+ def hashify(input)
58
+ if input.is_a? Array
59
+ input.map { |item| hashify(item) }
60
+ elsif input.is_a? Rubytoolbox::Api::ResponseWrapper
61
+ input.to_h
62
+ else
63
+ input
64
+ end
65
+ end
46
66
  end
47
67
  end
48
68
  end
@@ -4,7 +4,7 @@
4
4
  # :nocov:
5
5
  module Rubytoolbox
6
6
  class Api
7
- VERSION = "0.1.0"
7
+ VERSION = "0.2.0"
8
8
  end
9
9
  end
10
10
  # :nocov:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubytoolbox-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Olszowka
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-31 00:00:00.000000000 Z
11
+ date: 2020-06-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rubocop
@@ -164,6 +164,7 @@ files:
164
164
  - ".rubocop.yml"
165
165
  - ".simplecov"
166
166
  - ".travis.yml"
167
+ - CHANGELOG.md
167
168
  - CODE_OF_CONDUCT.md
168
169
  - Gemfile
169
170
  - Gemfile.lock