rubytoolbox-api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/README.md +2 -2
- data/lib/rubytoolbox/api/response_wrapper.rb +20 -0
- data/lib/rubytoolbox/api/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aa200befa539feb7c541d6e93ad35622d5755b170b651b9b8522aadc38ad4f0
|
4
|
+
data.tar.gz: 912b8c65a1562e1853b1092e5eb5aefe543d8c39e5353b24ba28e3654e1fa7cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95094f8b4071964c5f4e1080818d235db3079ad8005348a341cd650783d0fdc998d6567f868168b3dbfa69e3d166f59f226c7a31a644ce840844a66a8c32906f
|
7
|
+
data.tar.gz: cecc3df430e09ed720481c3220cdcfa31eedf2898440b01984d24e21641e36374819b40291f049a3f86457da844a69991a4dd4a83a1a71f4217c56790370e76d
|
data/CHANGELOG.md
ADDED
@@ -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/
|
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/
|
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
|
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.
|
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-
|
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
|