icecream 0.0.15 → 0.0.16
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/.travis.yml +1 -0
- data/lib/icecream/parser.rb +4 -2
- data/lib/icecream/version.rb +1 -1
- data/spec/parser_spec.rb +3 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6069e4b8e8ceffcd3ce6bfa8abff07bc4702e2aa
|
4
|
+
data.tar.gz: 3373aac79139459feb8b2dd9223c9c12af388568
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3097ab1e804df69cfd5603b5a2352acbc8c66f38eece84caf11ed5b5ec64dcdc6ee0c0505ac82cabcebe8389d8d33420593d3bf5f937cac657209db685588661
|
7
|
+
data.tar.gz: 3c6953af1f3a135a60fc1379c2bb899d77396fbb6f84528046ecb40166aca03e808e2b5f46851eb58deca838f3ee6146a29e2f11912364654f35c30d92c29b98
|
data/.travis.yml
CHANGED
data/lib/icecream/parser.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module IceCream
|
2
4
|
class Parser
|
3
5
|
|
@@ -31,8 +33,8 @@ module IceCream
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def self.fix_value value
|
34
|
-
if (value[0] == "{"
|
35
|
-
final = value
|
36
|
+
if (value[0] == "{" && JSON.parse(value))
|
37
|
+
final = JSON.parse(value)
|
36
38
|
elsif (value[0] == "[") && (value[-1, 1] == "]")
|
37
39
|
final = value.gsub("[","") .gsub("]","").split(",").map {|element| fix_value element.strip }
|
38
40
|
elsif value[0] == ":"
|
data/lib/icecream/version.rb
CHANGED
data/spec/parser_spec.rb
CHANGED
@@ -19,8 +19,9 @@ describe "Parser" do
|
|
19
19
|
end
|
20
20
|
it "Returns the right type of the value" do
|
21
21
|
|
22
|
-
# Json, should be treated as
|
23
|
-
|
22
|
+
# Json, should be treated as json
|
23
|
+
raw_json = '{"apiVersion":"2.0", "data":{ "updated":"2010-01-07T19:58:42.949Z", "totalItems":800, "startIndex":1, "itemsPerPage":1, "items":[ {"id":"hYB0mn5zh2c", "uploaded":"2007-06-05T22:07:03.000Z", "updated":"2010-01-07T13:26:50.000Z", "uploader":"GoogleDeveloperDay", "category":"News", "title":"Google Developers Day US - Maps API Introduction", "description":"Google Maps API Introduction ...", "tags":[ "GDD07","GDD07US","Maps" ], "thumbnail":{ "default":"http://i.ytimg.com/vi/hYB0mn5zh2c/default.jpg", "hqDefault":"http://i.ytimg.com/vi/hYB0mn5zh2c/hqdefault.jpg" }, "player":{ "default":"http://www.youtube.com/watch?vu003dhYB0mn5zh2c" }, "content":{ "1":"rtsp://v5.cache3.c.youtube.com/CiILENy.../0/0/0/video.3gp", "5":"http://www.youtube.com/v/hYB0mn5zh2c?f...", "6":"rtsp://v1.cache1.c.youtube.com/CiILENy.../0/0/0/video.3gp" }, "duration":2840, "aspectRatio":"widescreen", "rating":4.63, "ratingCount":68, "viewCount":220101, "favoriteCount":201, "commentCount":22, "status":{ "value":"restricted", "reason":"limitedSyndication" }, "accessControl":{ "syndicate":"allowed", "commentVote":"allowed", "rate":"allowed", "list":"allowed", "comment":"allowed", "embed":"allowed", "videoRespond":"moderated" } } ] } }'
|
24
|
+
IceCream::Parser.fix_value(raw_json).should == JSON.parse(raw_json)
|
24
25
|
|
25
26
|
# Strings
|
26
27
|
IceCream::Parser.fix_value("\"chocolate\"").should == "chocolate"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: icecream
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Camilo Ribeiro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-09-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|