whoopee-cushion 0.0.1 → 0.1.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/Gemfile +0 -2
- data/Gemfile.lock +1 -1
- data/README.md +37 -1
- data/lib/whoopee_cushion/version.rb +1 -1
- data/whoopee_cushion.gemspec +3 -0
- metadata +29 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ada589c5e9a9f9ff5bca6dbed49f5e8f217bb47
|
4
|
+
data.tar.gz: 80775f1deabb6de9a20c62c2030e12c12ea86921
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e41b72652029b3f0268331977f4f7fa21f27e51163d7246dfa46bbcbc00293378d9f46675d3d522316566f07a5e65e98b46250be230f833a974acc85130117b9
|
7
|
+
data.tar.gz: 96694182f4b57a80e7bae615b5ebb23e098e3633d3dada28b0dce765259c5c459fef9c2acfabaf64f4eabd2a4a47d40ae3e185f9849626d1c6bec127e68be2ef
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,4 +12,40 @@ Wouldn't it be nice if you could access all your API response data like this?
|
|
12
12
|
|
13
13
|
`obj.products.first.customer.customer_id`
|
14
14
|
|
15
|
-
whoopee-cushion will let you do just that. It's
|
15
|
+
whoopee-cushion will let you do just that. It's faster than using OpenStructs or any recursive algorithms based on them
|
16
|
+
because it uses Ruby's faster Struct objects under the hood.
|
17
|
+
|
18
|
+
Setup
|
19
|
+
=====
|
20
|
+
|
21
|
+
`gem install whoopee-cushion`
|
22
|
+
|
23
|
+
or
|
24
|
+
|
25
|
+
`gem "whoopee-cushion"`
|
26
|
+
|
27
|
+
in your Gemfile.
|
28
|
+
|
29
|
+
In your Ruby code:
|
30
|
+
|
31
|
+
`require 'whoopee_cushion'`
|
32
|
+
|
33
|
+
then
|
34
|
+
|
35
|
+
`hash = {:a => 1, :CamelCase => 2, :c => 3, :d => { :e => 4, :f => [1,2,3,4,5]}}`
|
36
|
+
|
37
|
+
`obj = WhoopeeCushion::Inflate.from_hash(hash)`
|
38
|
+
|
39
|
+
`puts obj.a`
|
40
|
+
`puts obj.camel_case`
|
41
|
+
`puts obj.d.f.first`
|
42
|
+
|
43
|
+
`json = '{"CamelCase": "no", "json": "yes"}'`
|
44
|
+
|
45
|
+
You can also go straight from JSON, or turn off the automatic camel case conversion:
|
46
|
+
|
47
|
+
`obj = WhoopeeCushion::Inflate.from_json(json, :to_snake_keys => false)`
|
48
|
+
|
49
|
+
`puts obj.CamelCase`
|
50
|
+
|
51
|
+
Have fun.
|
data/whoopee_cushion.gemspec
CHANGED
@@ -21,5 +21,8 @@ Gem::Specification.new do |spec|
|
|
21
21
|
spec.add_development_dependency "bundler", "~> 1.5"
|
22
22
|
spec.add_development_dependency "rake"
|
23
23
|
spec.add_development_dependency "minitest", "~> 4.7.3"
|
24
|
+
|
25
|
+
spec.add_development_dependency "byebug"
|
26
|
+
spec.add_development_dependency "recursive-open-struct"
|
24
27
|
end
|
25
28
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: whoopee-cushion
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Dunkley
|
@@ -52,6 +52,34 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: 4.7.3
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: recursive-open-struct
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
55
83
|
description: Inflates JSON data recursively into structs to allow use of dot notation
|
56
84
|
for data access.
|
57
85
|
email:
|