jinx-json 2.1.2 → 2.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -5,5 +5,5 @@ group :development do
5
5
  gem 'ruby-debug'
6
6
  # Uncomment to use a local gem.
7
7
  #gem 'jinx', :path => File.dirname(__FILE__) + '/../core'
8
- gem 'jinx-json', :path => File.dirname(__FILE__), :require => 'jinx/json'
8
+ gem 'jinx-json', :path => File.dirname(__FILE__)
9
9
  end
data/History.md CHANGED
@@ -1,6 +1,14 @@
1
1
  This history lists major release themes. See the GitHub commits (https://github.com/jinx/json)
2
2
  for change details.
3
3
 
4
+ 2.1.4 / 2012-11-01
5
+ ------------------
6
+ * Only serialize Java attributes.
7
+
8
+ 2.1.3 / 2012-06-16
9
+ ------------------
10
+ * Disable lazy loader.
11
+
4
12
  2.1.2 / 2012-06-12
5
13
  ------------------
6
14
  * Support caSmall web service.
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011 Oregon Health & Science University
1
+ Copyright (c) 2012 Oregon Health & Science University
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person
4
4
  obtaining a copy of this software and associated documentation
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  Jinx JSON plug-in
2
2
  =================
3
-
4
3
  **Home**: [http://github.com/jinx/json](http://github.com/jinx/json)
5
4
  **Git**: [http://github.com/jinx/json](http://github.com/jinx/json)
6
5
  **Author**: OHSU Knight Cancer Institute
@@ -24,8 +23,24 @@ Enable Jinx for a Java package, as described in the [Jinx](http://github.com/jin
24
23
  require 'jinx/json'
25
24
  jsoned = jinxed.to_json #=> the JSON representation of a jinxed resource
26
25
  JSON[jsoned] #=> the deserialized jinxed resource
26
+ JSON
27
+
28
+ The JSON payload consists of the following:
29
+
30
+ * The standard primitive Java properties, e.g. [caTissue](http://github.com/caruby/tissue)
31
+ <tt>SpecimenCollectionGroup.surgicalPathologyNumber</tt>. If there is a Java <tt>id</tt> property,
32
+ then designate that property with <tt>identifier</tt>, since <tt>id</tt> is a reserved Ruby
33
+ method.
34
+
35
+ * An object identifier property <tt>object_id</tt> which uniquely identifies the object in the scope
36
+ of the JSON object graph.
37
+
38
+ * The standard Jinx <tt>Resource<tt/> reference properties, e.g. caTissue
39
+ <tt>TissueSpecimen.specimenCollectionGroup</tt>. If the referenced object content contains the
40
+ <tt>object_id</tt> property, then the reference resolves to the object defined in the JSON
41
+ object graph with that <tt>object_id</tt> value.
27
42
 
28
43
  Copyright
29
44
  ---------
30
- Jinx &copy; 2011 by [Oregon Health & Science University](http://www.ohsu.edu/xd/health/services/cancer/index.cfm).
45
+ Jinx &copy; 2012 by [Oregon Health & Science University](http://www.ohsu.edu/xd/health/services/cancer).
31
46
  Jinx is licensed under the MIT license. Please see the LICENSE and LEGAL files for more information.
@@ -1,13 +1,16 @@
1
1
  require 'jinx/helpers/collection'
2
+ require 'jinx/json/state'
2
3
 
3
4
  module Jinx
4
5
  module Collection
5
6
  # Adds JSON serialization to collections.
6
7
  #
7
- # @param args the JSON serialization options
8
- # @return [String] the JSON representation of this Enumerable as an array
9
- def to_json(*args)
10
- to_a.to_json(*args)
8
+ # @param [State, Hash, nil] state the JSON state or serialization options
9
+ # @return [String] the JSON representation of this {Jinx::Resource}
10
+ def to_json(state=nil)
11
+ # Make a new State from the options if this is a top-level call.
12
+ state = JSON::State.for(state) unless JSON::State === state
13
+ to_a.to_json(state)
11
14
  end
12
15
  end
13
16
  end
@@ -1,4 +1,4 @@
1
- require 'jinx/helpers/hashable'
1
+ require 'jinx/helpers/hasher'
2
2
 
3
3
  module Jinx
4
4
  module JSON
@@ -1,4 +1,4 @@
1
- require 'jinx/helpers/hashable'
1
+ require 'jinx/helpers/hasher'
2
2
 
3
3
  module JSON
4
4
  # Bumps the default JSON nesting level to 100.
@@ -77,7 +77,7 @@ module Jinx
77
77
  return {:object_id => proxy_object_id}
78
78
  end
79
79
  visited << self
80
- vh = value_hash
80
+ vh = value_hash(self.class.java_attributes)
81
81
  vh.each { |pa, v| vh[pa] = v.to_a if Set === v }
82
82
  # Add the object id.
83
83
  vh[:object_id] = proxy_object_id
@@ -1,5 +1,5 @@
1
1
  module Jinx
2
2
  module JSON
3
- VERSION = '2.1.2'
3
+ VERSION = '2.1.4'
4
4
  end
5
5
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: jinx-json
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 2.1.2
5
+ version: 2.1.4
6
6
  platform: ruby
7
7
  authors:
8
8
  - OHSU
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-06-12 00:00:00 Z
13
+ date: 2012-11-01 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -91,7 +91,6 @@ files:
91
91
  - lib/jinx/json/deserializable.rb
92
92
  - lib/jinx/json/deserializer.rb
93
93
  - lib/jinx/json/serializable.rb
94
- - lib/jinx/json/set.rb
95
94
  - lib/jinx/json/state.rb
96
95
  - lib/jinx/json/version.rb
97
96
  - spec/serializer_spec.rb
data/lib/jinx/json/set.rb DELETED
File without changes