data_package 0.0.10 → 0.0.11
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/data_package.gemspec +1 -2
- data/lib/attr_helper/serialization.rb +6 -3
- data/lib/data_package/package.rb +1 -1
- data/lib/data_package/version.rb +1 -1
- data/spec/attr_helpers/serialization_spec.rb +1 -1
- data/spec/data_package/dialect_spec.rb +1 -1
- data/spec/data_package/field_spec.rb +1 -1
- data/spec/data_package/license_spec.rb +1 -1
- data/spec/data_package/person_spec.rb +1 -1
- data/spec/data_package/schema_spec.rb +3 -3
- data/spec/data_package/source_spec.rb +1 -1
- metadata +3 -17
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8ad6cf50c1fb9c79e9716c1759a8f22a06a938a1
|
|
4
|
+
data.tar.gz: 2e042771bed18b05c3565251eae90a90abc00c57
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ad22ab12a886cda11fbc789f2899d9e356c2cacb942a0238ddc742ae5e660d2306c77be0d814ccbe14725886fab9d9223ac43943f504de509157fa7501d12bee
|
|
7
|
+
data.tar.gz: 8e8ae9e91a8836632db62eee6ba8bacf9534d528291e987cd827786596c007c3d161008211ff11148d239605cdd39e024b38349c1174aec4175862fbe4577e5a
|
data/data_package.gemspec
CHANGED
|
@@ -19,8 +19,7 @@ Gem::Specification.new do |spec|
|
|
|
19
19
|
spec.require_paths = ["lib"]
|
|
20
20
|
|
|
21
21
|
# Runtime Dependencies
|
|
22
|
-
spec.add_runtime_dependency '
|
|
23
|
-
spec.add_runtime_dependency 'yajl-ruby'
|
|
22
|
+
spec.add_runtime_dependency 'json'
|
|
24
23
|
spec.add_runtime_dependency 'data_kit'
|
|
25
24
|
|
|
26
25
|
# Development Dependencies
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
require '
|
|
1
|
+
require 'json'
|
|
2
2
|
|
|
3
3
|
module AttrHelper
|
|
4
4
|
module Serialization
|
|
@@ -19,8 +19,11 @@ module AttrHelper
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
def to_json(options = {})
|
|
22
|
-
options
|
|
23
|
-
|
|
22
|
+
if options[:pretty].nil? || options[:pretty]
|
|
23
|
+
JSON.pretty_generate(to_hash)
|
|
24
|
+
else
|
|
25
|
+
JSON.generate(to_hash)
|
|
26
|
+
end
|
|
24
27
|
end
|
|
25
28
|
end
|
|
26
29
|
end
|
data/lib/data_package/package.rb
CHANGED
data/lib/data_package/version.rb
CHANGED
|
@@ -4,6 +4,6 @@ require 'klass_helper'
|
|
|
4
4
|
describe AttrHelper do
|
|
5
5
|
it "should serialize" do
|
|
6
6
|
obj = KlassHelper::BaseKlass.new(:name => 'myvalue')
|
|
7
|
-
obj.to_json.should ==
|
|
7
|
+
obj.to_json.should == JSON.pretty_generate({:name => 'myvalue'})
|
|
8
8
|
end
|
|
9
9
|
end
|
|
@@ -19,7 +19,7 @@ describe DataPackage::Field do
|
|
|
19
19
|
field.description.should == json['description']
|
|
20
20
|
|
|
21
21
|
field.to_hash.should == json
|
|
22
|
-
field.to_json.should ==
|
|
22
|
+
field.to_json.should == JSON.pretty_generate(field.to_hash)
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
it "should require a name" do
|
|
@@ -13,6 +13,6 @@ describe DataPackage::License do
|
|
|
13
13
|
|
|
14
14
|
license.id.should == 'PDDL'
|
|
15
15
|
license.url.should == 'http://opendatacommons.org/licenses/pddl/'
|
|
16
|
-
license.to_json.should ==
|
|
16
|
+
license.to_json.should == JSON.pretty_generate(json)
|
|
17
17
|
end
|
|
18
18
|
end
|
|
@@ -16,6 +16,6 @@ describe DataPackage::Person do
|
|
|
16
16
|
person.email.should == 'josh@modeanalytics.com'
|
|
17
17
|
person.web.should == 'http://www.modeanalytics.com/josh'
|
|
18
18
|
|
|
19
|
-
person.to_json.should ==
|
|
19
|
+
person.to_json.should == JSON.pretty_generate(json)
|
|
20
20
|
end
|
|
21
21
|
end
|
|
@@ -23,7 +23,7 @@ describe DataPackage::Schema do
|
|
|
23
23
|
schema.has_primary_key?.should == true
|
|
24
24
|
|
|
25
25
|
modified_json = json.merge('primaryKey' => 'income')
|
|
26
|
-
schema.to_json.should ==
|
|
26
|
+
schema.to_json.should == JSON.pretty_generate(modified_json)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
it "should initialize with string primaryKey" do
|
|
@@ -35,7 +35,7 @@ describe DataPackage::Schema do
|
|
|
35
35
|
schema.fields.first.name.should == 'income'
|
|
36
36
|
schema.primary_key.should == ['income']
|
|
37
37
|
schema.has_primary_key?.should == true
|
|
38
|
-
schema.to_json.should ==
|
|
38
|
+
schema.to_json.should == JSON.pretty_generate(modified_json)
|
|
39
39
|
end
|
|
40
40
|
|
|
41
41
|
it "should have primary key accessor" do
|
|
@@ -47,6 +47,6 @@ describe DataPackage::Schema do
|
|
|
47
47
|
schema.fields.first.name.should == 'income'
|
|
48
48
|
schema.primary_key.should == []
|
|
49
49
|
schema.has_primary_key?.should == false
|
|
50
|
-
schema.to_json.should ==
|
|
50
|
+
schema.to_json.should == JSON.pretty_generate(modified_json)
|
|
51
51
|
end
|
|
52
52
|
end
|
|
@@ -17,6 +17,6 @@ describe DataPackage::Source do
|
|
|
17
17
|
person.web.should == 'http://www.modeanalytics.com/josh'
|
|
18
18
|
|
|
19
19
|
person.to_hash.should == json
|
|
20
|
-
person.to_json.should ==
|
|
20
|
+
person.to_json.should == JSON.pretty_generate(person.to_hash)
|
|
21
21
|
end
|
|
22
22
|
end
|
metadata
CHANGED
|
@@ -1,31 +1,17 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: data_package
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.11
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Mode Analytics
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-01-
|
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
|
-
name:
|
|
15
|
-
requirement: !ruby/object:Gem::Requirement
|
|
16
|
-
requirements:
|
|
17
|
-
- - '>='
|
|
18
|
-
- !ruby/object:Gem::Version
|
|
19
|
-
version: '0'
|
|
20
|
-
type: :runtime
|
|
21
|
-
prerelease: false
|
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
-
requirements:
|
|
24
|
-
- - '>='
|
|
25
|
-
- !ruby/object:Gem::Version
|
|
26
|
-
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: yajl-ruby
|
|
14
|
+
name: json
|
|
29
15
|
requirement: !ruby/object:Gem::Requirement
|
|
30
16
|
requirements:
|
|
31
17
|
- - '>='
|