spectifly 0.0.7 → 0.0.8

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.
@@ -11,8 +11,8 @@ module Spectifly
11
11
  end
12
12
 
13
13
  def multiple?
14
- ['has_many', 'has_many_and_belongs_to'].include? relationship
14
+ ['has_many', 'has_many_and_belongs_to', 'belongs_to_many'].include? relationship
15
15
  end
16
16
  end
17
17
  end
18
- end
18
+ end
@@ -1,3 +1,3 @@
1
1
  module Spectifly
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -7,7 +7,7 @@ module Spectifly
7
7
 
8
8
  def to_xsd(builder = nil)
9
9
  builder ||= ::Builder::XmlMarkup.new(:indent => 2)
10
- if relationship == 'belongs_to'
10
+ if relationship =~ /^belongs_to(_many)?/
11
11
  attributes['name'] = "#{name}Id"
12
12
  attributes['type'] = "xs:string"
13
13
  else
@@ -27,7 +27,7 @@ module Spectifly
27
27
  def types
28
28
  [
29
29
  fields.map(&:type) +
30
- associations.select { |a| a.relationship != 'belongs_to' }.map(&:type)
30
+ associations.select { |a| a.relationship !~ /belongs_to(_many)?/ }.map(&:type)
31
31
  ].flatten.compact.uniq
32
32
  end
33
33
 
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "individual": {
3
3
  "belongs_to": {
4
- "party": {
4
+ "political_party": {
5
5
  "type": "group",
6
6
  "required": true,
7
- "description": "Which funtime party this individual happy with is"
7
+ "description": "Less funtime party that aligns with this individual's ideals"
8
8
  },
9
9
  "stupid_club": {
10
10
  "type": "group",
@@ -12,6 +12,13 @@
12
12
  "description": "Which stupid club this individual was manipulated into joining"
13
13
  }
14
14
  },
15
+ "belongs_to_many": {
16
+ "parties": {
17
+ "type": "group",
18
+ "required": false,
19
+ "description": "Which funtime party/parties this individual happy with is"
20
+ }
21
+ },
15
22
  "name": {
16
23
  "type": "string",
17
24
  "multiple": false,
@@ -59,4 +66,4 @@
59
66
  "description": "Whether or not this individual is pickled"
60
67
  }
61
68
  }
62
- }
69
+ }
@@ -36,9 +36,9 @@
36
36
  <xs:documentation>Whether or not this individual is pickled</xs:documentation>
37
37
  </xs:annotation>
38
38
  </xs:element>
39
- <xs:element name="PartyId" type="xs:string">
39
+ <xs:element name="PoliticalPartyId" type="xs:string">
40
40
  <xs:annotation>
41
- <xs:documentation>Which funtime party this individual happy with is</xs:documentation>
41
+ <xs:documentation>Less funtime party that aligns with this individual's ideals</xs:documentation>
42
42
  </xs:annotation>
43
43
  </xs:element>
44
44
  <xs:element name="StupidClubId" type="xs:string" minOccurs="0">
@@ -46,6 +46,11 @@
46
46
  <xs:documentation>Which stupid club this individual was manipulated into joining</xs:documentation>
47
47
  </xs:annotation>
48
48
  </xs:element>
49
+ <xs:element name="PartiesId" type="xs:string" minOccurs="0" maxOccurs="unbounded">
50
+ <xs:annotation>
51
+ <xs:documentation>Which funtime party/parties this individual happy with is</xs:documentation>
52
+ </xs:annotation>
53
+ </xs:element>
49
54
  </xs:sequence>
50
55
  </xs:complexType>
51
56
  </xs:schema>
@@ -1,17 +1,19 @@
1
1
  {
2
2
  "individual": {
3
3
  "belongs_to": {
4
- "party": {
5
- "type": "group",
6
- "required": true,
7
- "description": "Which funtime party this individual happy with is"
8
- },
9
4
  "stupid_club": {
10
5
  "type": "group",
11
6
  "required": false,
12
7
  "description": "Which stupid club this individual was manipulated into joining"
13
8
  }
14
9
  },
10
+ "belongs_to_many": {
11
+ "parties": {
12
+ "type": "group",
13
+ "required": false,
14
+ "description": "Which funtime party/parties this individual happy with is"
15
+ }
16
+ },
15
17
  "name": {
16
18
  "type": "string",
17
19
  "multiple": false,
@@ -46,4 +48,4 @@
46
48
  "description": "Whether or not this individual is pickled"
47
49
  }
48
50
  }
49
- }
51
+ }
@@ -24,14 +24,14 @@
24
24
  <xs:documentation>Whether or not this individual is pickled</xs:documentation>
25
25
  </xs:annotation>
26
26
  </xs:element>
27
- <xs:element name="PartyId" type="xs:string">
27
+ <xs:element name="StupidClubId" type="xs:string" minOccurs="0">
28
28
  <xs:annotation>
29
- <xs:documentation>Which funtime party this individual happy with is</xs:documentation>
29
+ <xs:documentation>Which stupid club this individual was manipulated into joining</xs:documentation>
30
30
  </xs:annotation>
31
31
  </xs:element>
32
- <xs:element name="StupidClubId" type="xs:string" minOccurs="0">
32
+ <xs:element name="PartiesId" type="xs:string" minOccurs="0" maxOccurs="unbounded">
33
33
  <xs:annotation>
34
- <xs:documentation>Which stupid club this individual was manipulated into joining</xs:documentation>
34
+ <xs:documentation>Which funtime party/parties this individual happy with is</xs:documentation>
35
35
  </xs:annotation>
36
36
  </xs:element>
37
37
  </xs:sequence>
@@ -28,10 +28,15 @@ Individual:
28
28
 
29
29
  Related Entities:
30
30
  Belongs To:
31
- Party*:
32
- Description: Which funtime party this individual happy with is
31
+ Political Party*:
32
+ Description: Less funtime party that aligns with this individual's ideals
33
33
  Type: Group
34
34
 
35
35
  Stupid Club:
36
36
  Description: Which stupid club this individual was manipulated into joining
37
- Type: Group
37
+ Type: Group
38
+
39
+ Belongs To Many:
40
+ Parties:
41
+ Description: Which funtime party/parties this individual happy with is
42
+ Type: Group
@@ -9,5 +9,6 @@ Individual:
9
9
  Pickled?:
10
10
  Related Entities:
11
11
  Belongs To:
12
- Party*:
13
12
  Stupid Club:
13
+ Belongs To Many:
14
+ Parties:
@@ -7,7 +7,7 @@ describe Spectifly::Json::Builder do
7
7
  entity = Spectifly::Entity.parse(fixture_path('individual'))
8
8
  json_path = expectation_path('individual', 'json')
9
9
  hash = described_class.new(entity).build
10
- JSON.pretty_generate(hash).should == File.read(json_path)
10
+ JSON.pretty_generate(hash).strip.should == File.read(json_path).strip
11
11
  end
12
12
 
13
13
  it 'works with containing relationships' do
@@ -26,7 +26,7 @@ describe Spectifly::Json::Builder do
26
26
  builder = described_class.new(entity)
27
27
  builder.present_as(presenter_entity).should == builder
28
28
  hash = builder.build
29
- JSON.pretty_generate(hash).should == File.read(json_path)
29
+ JSON.pretty_generate(hash).strip.should == File.read(json_path).strip
30
30
  end
31
31
 
32
32
  it 'works with overriding relationships' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spectifly
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-16 00:00:00.000000000 Z
12
+ date: 2013-09-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: builder
@@ -207,12 +207,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
207
207
  - - ! '>='
208
208
  - !ruby/object:Gem::Version
209
209
  version: '0'
210
+ segments:
211
+ - 0
212
+ hash: 4342167303691961125
210
213
  required_rubygems_version: !ruby/object:Gem::Requirement
211
214
  none: false
212
215
  requirements:
213
216
  - - ! '>='
214
217
  - !ruby/object:Gem::Version
215
218
  version: '0'
219
+ segments:
220
+ - 0
221
+ hash: 4342167303691961125
216
222
  requirements: []
217
223
  rubyforge_project:
218
224
  rubygems_version: 1.8.23
@@ -248,4 +254,3 @@ test_files:
248
254
  - spec/spectifly/xsd/field_spec.rb
249
255
  - spec/spectifly/xsd/types_spec.rb
250
256
  - spec/support/path_helper.rb
251
- has_rdoc: