openc_bot 0.0.16 → 0.0.18

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.
Files changed (175) hide show
  1. data/.gitmodules +3 -0
  2. data/.travis.yml +2 -1
  3. data/examples/basic/lib/basic.rb +3 -2
  4. data/lib/openc_bot/helpers/register_methods.rb +2 -1
  5. data/lib/openc_bot/templates/lib/simple_bot.rb +3 -2
  6. data/lib/openc_bot/version.rb +1 -1
  7. data/lib/simple_openc_bot.rb +2 -2
  8. data/openc_bot.gemspec +13 -0
  9. data/publish.sh +12 -0
  10. data/schemas/.gitignore +13 -0
  11. data/schemas/.travis.yml +5 -0
  12. data/schemas/Gemfile +9 -0
  13. data/schemas/Gemfile.lock +34 -0
  14. data/schemas/README.md +2 -0
  15. data/schemas/Rakefile +46 -0
  16. data/schemas/lib/base-statement.json +22 -0
  17. data/schemas/lib/snippets/financial-payment-base.json +4 -0
  18. data/schemas/lib/snippets/licence-base.json +4 -0
  19. data/schemas/{company-schema.json → schemas/company-schema.json} +0 -0
  20. data/schemas/schemas/financial-payment-schema.json +27 -0
  21. data/schemas/{includes → schemas/includes}/address.json +0 -0
  22. data/schemas/{includes → schemas/includes}/alternative_name.json +1 -1
  23. data/schemas/{includes → schemas/includes}/company.json +2 -0
  24. data/schemas/{includes → schemas/includes}/filing.json +0 -0
  25. data/schemas/schemas/includes/financial-payment-data-object.json +60 -0
  26. data/schemas/{includes → schemas/includes}/industry_code.json +0 -0
  27. data/schemas/{includes/license-data.json → schemas/includes/licence-data-object.json} +13 -4
  28. data/schemas/{includes → schemas/includes}/officer.json +0 -0
  29. data/schemas/{includes → schemas/includes}/previous_name.json +0 -0
  30. data/schemas/{includes → schemas/includes}/share-parcel-data.json +0 -0
  31. data/schemas/{includes → schemas/includes}/share-parcel.json +0 -0
  32. data/schemas/{includes → schemas/includes}/subsidiary-relationship-data.json +4 -9
  33. data/schemas/{includes → schemas/includes}/total-shares.json +0 -0
  34. data/schemas/schemas/licence-schema.json +27 -0
  35. data/schemas/schemas/primary-data-schema.json +17 -0
  36. data/schemas/{share-parcel-schema.json → schemas/share-parcel-schema.json} +0 -0
  37. data/schemas/schemas/simple-financial-payment-schema.json +85 -0
  38. data/schemas/schemas/simple-licence-schema.json +54 -0
  39. data/schemas/schemas/simple-subsidiary-schema.json +62 -0
  40. data/schemas/schemas/subsidiary-relationship-schema.json +27 -0
  41. data/schemas/spec/sample-data/invalid/company-01.json +4 -0
  42. data/schemas/spec/sample-data/invalid/company-02.json +5 -0
  43. data/schemas/spec/sample-data/invalid/company-03.json +5 -0
  44. data/schemas/spec/sample-data/invalid/company-04.json +5 -0
  45. data/schemas/spec/sample-data/invalid/company-05.json +5 -0
  46. data/schemas/spec/sample-data/invalid/company-06.json +6 -0
  47. data/schemas/spec/sample-data/invalid/company-07.json +8 -0
  48. data/schemas/spec/sample-data/invalid/company-08.json +7 -0
  49. data/schemas/spec/sample-data/invalid/company-09.json +9 -0
  50. data/schemas/spec/sample-data/invalid/company-10.json +7 -0
  51. data/schemas/spec/sample-data/invalid/company-11.json +9 -0
  52. data/schemas/spec/sample-data/invalid/company-12.json +11 -0
  53. data/schemas/spec/sample-data/invalid/company-13.json +11 -0
  54. data/schemas/spec/sample-data/invalid/company-14.json +7 -0
  55. data/schemas/spec/sample-data/invalid/company-15.json +7 -0
  56. data/schemas/spec/sample-data/invalid/company-16.json +7 -0
  57. data/schemas/spec/sample-data/invalid/company-17.json +9 -0
  58. data/schemas/spec/sample-data/invalid/company-18.json +9 -0
  59. data/schemas/spec/sample-data/invalid/company-19.json +9 -0
  60. data/schemas/spec/sample-data/invalid/company-20.json +9 -0
  61. data/schemas/spec/sample-data/invalid/company-21.json +11 -0
  62. data/schemas/spec/sample-data/invalid/company-22.json +11 -0
  63. data/schemas/spec/sample-data/invalid/company-23.json +7 -0
  64. data/schemas/spec/sample-data/invalid/company-24.json +12 -0
  65. data/schemas/spec/sample-data/invalid/company-25.json +9 -0
  66. data/schemas/spec/sample-data/invalid/company-26.json +11 -0
  67. data/schemas/spec/sample-data/invalid/company-27.json +7 -0
  68. data/schemas/spec/sample-data/invalid/company-28.json +9 -0
  69. data/schemas/spec/sample-data/invalid/company-29.json +12 -0
  70. data/schemas/spec/sample-data/invalid/company-30.json +16 -0
  71. data/schemas/spec/sample-data/invalid/company-31.json +14 -0
  72. data/schemas/spec/sample-data/invalid/company-32.json +11 -0
  73. data/schemas/spec/sample-data/invalid/company-33.json +7 -0
  74. data/schemas/spec/sample-data/invalid/company-34.json +9 -0
  75. data/schemas/spec/sample-data/invalid/company-35.json +9 -0
  76. data/schemas/spec/sample-data/invalid/company-36.json +10 -0
  77. data/schemas/spec/sample-data/invalid/company-37.json +7 -0
  78. data/schemas/spec/sample-data/invalid/company-38.json +9 -0
  79. data/schemas/spec/sample-data/invalid/company-39.json +11 -0
  80. data/schemas/spec/sample-data/invalid/company-40.json +12 -0
  81. data/schemas/spec/sample-data/invalid/company-41.json +12 -0
  82. data/schemas/spec/sample-data/invalid/company-42.json +7 -0
  83. data/schemas/spec/sample-data/invalid/company-43.json +9 -0
  84. data/schemas/spec/sample-data/invalid/company-44.json +11 -0
  85. data/schemas/spec/sample-data/invalid/company-45.json +11 -0
  86. data/schemas/spec/sample-data/invalid/company-46.json +7 -0
  87. data/schemas/spec/sample-data/invalid/company-47.json +9 -0
  88. data/schemas/spec/sample-data/invalid/company-48.json +9 -0
  89. data/schemas/spec/sample-data/invalid/company-49.json +9 -0
  90. data/schemas/spec/sample-data/invalid/company-50.json +9 -0
  91. data/schemas/spec/sample-data/invalid/company-51.json +9 -0
  92. data/schemas/spec/sample-data/invalid/company-52.json +9 -0
  93. data/schemas/spec/sample-data/invalid/company-53.json +10 -0
  94. data/schemas/spec/sample-data/invalid/company-54.json +9 -0
  95. data/schemas/spec/sample-data/invalid/company-55.json +9 -0
  96. data/schemas/spec/sample-data/invalid/financial-payment-01.json +24 -0
  97. data/schemas/spec/sample-data/invalid/licence-01.json +18 -0
  98. data/schemas/spec/sample-data/invalid/licence-02.json +18 -0
  99. data/schemas/spec/sample-data/invalid/licence-03.json +12 -0
  100. data/schemas/spec/sample-data/invalid/licence-04.json +18 -0
  101. data/schemas/spec/sample-data/invalid/licence-05.json +18 -0
  102. data/schemas/spec/sample-data/invalid/licence-06.json +18 -0
  103. data/schemas/spec/sample-data/invalid/licence-07.json +20 -0
  104. data/schemas/spec/sample-data/invalid/licence-08.json +21 -0
  105. data/schemas/spec/sample-data/invalid/primary-data-01.json +4 -0
  106. data/schemas/spec/sample-data/invalid/primary-data-02.json +4 -0
  107. data/schemas/spec/sample-data/invalid/simple-licence-01.json +9 -0
  108. data/schemas/spec/sample-data/invalid/simple-licence-02.json +8 -0
  109. data/schemas/spec/sample-data/invalid/simple-licence-03.json +9 -0
  110. data/schemas/spec/sample-data/invalid/simple-subsidiary-01.json +13 -0
  111. data/schemas/{licence-schema.json → spec/sample-data/licence-schema.json.old} +1 -1
  112. data/schemas/spec/sample-data/valid/company-01.json +6 -0
  113. data/schemas/spec/sample-data/valid/company-02.json +7 -0
  114. data/schemas/spec/sample-data/valid/company-03.json +8 -0
  115. data/schemas/spec/sample-data/valid/company-04.json +7 -0
  116. data/schemas/spec/sample-data/valid/company-05.json +7 -0
  117. data/schemas/spec/sample-data/valid/company-06.json +12 -0
  118. data/schemas/spec/sample-data/valid/company-07.json +9 -0
  119. data/schemas/spec/sample-data/valid/company-08.json +9 -0
  120. data/schemas/spec/sample-data/valid/company-09.json +20 -0
  121. data/schemas/spec/sample-data/valid/company-10.json +9 -0
  122. data/schemas/spec/sample-data/valid/company-11.json +7 -0
  123. data/schemas/spec/sample-data/valid/company-12.json +7 -0
  124. data/schemas/spec/sample-data/valid/company-13.json +7 -0
  125. data/schemas/spec/sample-data/valid/company-14.json +15 -0
  126. data/schemas/spec/sample-data/valid/company-15.json +8 -0
  127. data/schemas/spec/sample-data/valid/company-16.json +9 -0
  128. data/schemas/spec/sample-data/valid/company-17.json +9 -0
  129. data/schemas/spec/sample-data/valid/company-18.json +9 -0
  130. data/schemas/spec/sample-data/valid/company-19.json +26 -0
  131. data/schemas/spec/sample-data/valid/company-20.json +9 -0
  132. data/schemas/spec/sample-data/valid/company-21.json +26 -0
  133. data/schemas/spec/sample-data/valid/company-22.json +20 -0
  134. data/schemas/spec/sample-data/valid/company-23.json +9 -0
  135. data/schemas/spec/sample-data/valid/company-24.json +12 -0
  136. data/schemas/spec/sample-data/valid/company-25.json +12 -0
  137. data/schemas/spec/sample-data/valid/company-26.json +12 -0
  138. data/schemas/spec/sample-data/valid/company-27.json +28 -0
  139. data/schemas/spec/sample-data/valid/company-28.json +9 -0
  140. data/schemas/spec/sample-data/valid/company-29.json +10 -0
  141. data/schemas/spec/sample-data/valid/company-30.json +9 -0
  142. data/schemas/spec/sample-data/valid/company-31.json +17 -0
  143. data/schemas/spec/sample-data/valid/company-32.json +9 -0
  144. data/schemas/spec/sample-data/valid/company-33.json +24 -0
  145. data/schemas/spec/sample-data/valid/company-34.json +9 -0
  146. data/schemas/spec/sample-data/valid/company-35.json +9 -0
  147. data/schemas/spec/sample-data/valid/company-36.json +9 -0
  148. data/schemas/spec/sample-data/valid/company-37.json +9 -0
  149. data/schemas/spec/sample-data/valid/company-38.json +9 -0
  150. data/schemas/spec/sample-data/valid/company-39.json +9 -0
  151. data/schemas/spec/sample-data/valid/company-40.json +9 -0
  152. data/schemas/spec/sample-data/valid/company-41.json +9 -0
  153. data/schemas/spec/sample-data/valid/company-42.json +10 -0
  154. data/schemas/spec/sample-data/valid/financial-payment-01.json +25 -0
  155. data/schemas/spec/sample-data/valid/financial-payment-02.json +29 -0
  156. data/schemas/spec/sample-data/valid/licence-01.json +19 -0
  157. data/schemas/spec/sample-data/valid/licence-02.json +21 -0
  158. data/schemas/spec/sample-data/valid/licence-03.json +21 -0
  159. data/schemas/spec/sample-data/valid/licence-04.json +26 -0
  160. data/schemas/spec/sample-data/valid/primary-data-01.json +4 -0
  161. data/schemas/spec/sample-data/valid/primary-data-02.json +5 -0
  162. data/schemas/spec/sample-data/valid/simple-licence-01.json +10 -0
  163. data/schemas/spec/sample-data/valid/simple-licence-02.json +10 -0
  164. data/schemas/spec/sample-data/valid/simple-licence-03.json +12 -0
  165. data/schemas/spec/sample-data/valid/simple-subsidiary-01.json +13 -0
  166. data/schemas/spec/sample-data/valid/simple-subsidiary-02.json +13 -0
  167. data/schemas/spec/sample-data/valid/subsidiary-relationship-01.json +23 -0
  168. data/schemas/spec/spec_helper.rb +78 -0
  169. data/schemas/spec/validation_spec.rb +39 -0
  170. data/spec/lib/helpers/register_methods_spec.rb +1 -1
  171. data/spec/schemas/company-schema_spec.rb +4 -3
  172. data/spec/simple_openc_bot_spec.rb +9 -8
  173. metadata +164 -19
  174. data/schemas/includes/base-statement.json +0 -27
  175. data/schemas/subsidiary-relationship-schema.json +0 -19
@@ -0,0 +1,12 @@
1
+ /*valid filings*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "filings": [
7
+ {
8
+ "description": "Some type",
9
+ "date": "2010-11-22"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,12 @@
1
+ /*valid filings*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "filings": [
7
+ {
8
+ "title": "Some type",
9
+ "date": "2010-11-22"
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,28 @@
1
+ /*valid share_parcels*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "share_parcels": [
7
+ {
8
+ "number_of_shares": 1234,
9
+ "shareholders": [
10
+ {
11
+ "name": "Fred Flintstone"
12
+ }
13
+ ],
14
+ "confidence": 42
15
+ },
16
+ {
17
+ "percentage_of_shares": 23.5,
18
+ "shareholders": [
19
+ {
20
+ "name": "Barney Rubble"
21
+ },
22
+ {
23
+ "name": "Wilma Flintstone"
24
+ }
25
+ ]
26
+ }
27
+ ]
28
+ }
@@ -0,0 +1,9 @@
1
+ /*valid share_parcels*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "share_parcels": [
7
+
8
+ ]
9
+ }
@@ -0,0 +1,10 @@
1
+ /*valid total_shares*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "total_shares": {
7
+ "number": 123,
8
+ "share_class": "Ordinary"
9
+ }
10
+ }
@@ -0,0 +1,9 @@
1
+ /*valid total_shares*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "total_shares": {
7
+ "number": 123
8
+ }
9
+ }
@@ -0,0 +1,17 @@
1
+ /*valid alternative_names*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "alternative_names": [
7
+ {
8
+ "company_name": "Foobar Inc",
9
+ "type": "trading"
10
+ },
11
+ {
12
+ "company_name": "Foobar Inc",
13
+ "type": "legal",
14
+ "language": "fr"
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,9 @@
1
+ /*valid alternative_names*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "alternative_names": [
7
+
8
+ ]
9
+ }
@@ -0,0 +1,24 @@
1
+ /*valid industry_codes*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "industry_codes": [
7
+ {
8
+ "code": "1234",
9
+ "code_scheme_id": "eu_nace_2",
10
+ "name": "Some Industry"
11
+ },
12
+ {
13
+ "code": "22.11",
14
+ "code_scheme_id": "uk_sic_2007"
15
+ },
16
+ {
17
+ "code": "43.21",
18
+ "code_scheme_id": "us_naics_2007",
19
+ "name": "Another Industry",
20
+ "start_date": "2010-12-22",
21
+ "end_date": "2011-01-03"
22
+ }
23
+ ]
24
+ }
@@ -0,0 +1,9 @@
1
+ /*valid industry_codes*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "industry_codes": [
7
+
8
+ ]
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid home_company_number*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "home_company_number": "Some String"
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid home_company_number*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "home_company_number": null
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid home_legal_name*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "home_legal_name": "Some String"
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid home_legal_name*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "home_legal_name": null
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid registered_agent_name*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "registered_agent_name": "Some String"
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid registered_agent_name*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "registered_agent_name": null
8
+ }
9
+ }
@@ -0,0 +1,9 @@
1
+ /*valid registered_agent_address*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "registered_agent_address": "Some String"
8
+ }
9
+ }
@@ -0,0 +1,10 @@
1
+ /*valid registered_agent_address*/
2
+ {
3
+ "name": "Foo Inc",
4
+ "company_number": "12345",
5
+ "jurisdiction_code": "ie",
6
+ "all_attributes": {
7
+ "registered_agent_address": null
8
+ }
9
+
10
+ }
@@ -0,0 +1,25 @@
1
+ { "company":
2
+ {
3
+ "name": "Some suppplier",
4
+ "jurisdiction": "France"
5
+ },
6
+ "data": [
7
+ { "data_type": "financial_payment",
8
+ "properties": {
9
+ "value": "32.45",
10
+ "currency": "GBP",
11
+ "transaction_number": "ABC1224",
12
+ "reporting_date": "2014-06-01",
13
+ "jurisdiction": "gb",
14
+ "more_details_url": "http://spendnetwork.com/trans_id/12345",
15
+ "description": "some big project",
16
+ "payee_name": "Govt Jobs R Us Inc",
17
+ "entity_name": "Efficiency Agency",
18
+ "department_name": "Department Of Everything",
19
+ "date": "2012-10-22"
20
+ },
21
+ "source_url": "http://example.com/abc123",
22
+ "confidence": "67"
23
+ }
24
+ ]
25
+ }
@@ -0,0 +1,29 @@
1
+ {
2
+ "company": {
3
+ "jurisdiction": "gb",
4
+ "name": "LAFARGE AGGREGATES LTD"
5
+ },
6
+ "data": [
7
+ {
8
+ "confidence": "80",
9
+ "data_type": "financial_payment",
10
+ "properties": {
11
+ "csv_line_number": "1921",
12
+ "currency": "GBP",
13
+ "date": "2012-09-01",
14
+ "department_name": null,
15
+ "description": null,
16
+ "entity_name": "Norfolk County Council",
17
+ "entity_uri": null,
18
+ "expense_area": null,
19
+ "jurisdiction": "gb",
20
+ "more_details_url": "https://spendnetwork.com/transaction_detail/E2620_NCC_gov_2012_09_1921",
21
+ "payee_name": "LAFARGE AGGREGATES LTD",
22
+ "transaction_number": "E2620_NCC_gov_2012_09_1921",
23
+ "uid": "4182095",
24
+ "value": "491.54"
25
+ },
26
+ "source_url": "https://spendnetwork.com/transaction_detail/E2620_NCC_gov_2012_09_1921"
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,19 @@
1
+ { "company":
2
+ {
3
+ "name": "CENTRAL BANK",
4
+ "jurisdiction": "IA"
5
+ },
6
+ "data": [
7
+ { "data_type": "licence",
8
+ "properties": {
9
+ "licence_number": "ABC123",
10
+ "category": "Financial",
11
+ "jurisdiction_classification": ["Bank"],
12
+ "jurisdiction_code": "France",
13
+ "reporting_date": "2014-06-01"
14
+ },
15
+ "source_url": "http://example.com/abc123",
16
+ "confidence": "67"
17
+ }
18
+ ]
19
+ }
@@ -0,0 +1,21 @@
1
+ { "company":
2
+ {
3
+ "name": "CENTRAL BANK",
4
+ "jurisdiction": "IA",
5
+ "identifier": "abc/123",
6
+ "company_number": "12345"
7
+ },
8
+ "data": [
9
+ { "data_type": "licence",
10
+ "properties": {
11
+ "category":"Financial",
12
+ "licence_number": "ABC123",
13
+ "jurisdiction_classification": ["Bank"],
14
+ "jurisdiction_code": "France",
15
+ "sample_date": "2014-06-01"
16
+ },
17
+ "source_url": "http://example.com/abc123",
18
+ "confidence": "67"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,21 @@
1
+ { "company":
2
+ {
3
+ "name": "CENTRAL BANK",
4
+ "jurisdiction": "IA",
5
+ "identifier": "abc/123",
6
+ "company_number": "12345"
7
+ },
8
+ "data": [
9
+ { "data_type": "licence",
10
+ "properties": {
11
+ "category":"Business",
12
+ "licence_number": "ABC123",
13
+ "jurisdiction_classification": ["Liquor Sales"],
14
+ "jurisdiction_code": "Michigan",
15
+ "sample_date": "2014-06-01"
16
+ },
17
+ "source_url": "http://example.com/abc123",
18
+ "confidence": "67"
19
+ }
20
+ ]
21
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "company": {
3
+ "jurisdiction": "CA",
4
+ "name": "WYVERN RESTAURANTS INC",
5
+ "source_jurisdiction": "us_ca"
6
+ },
7
+ "data": [
8
+ {
9
+ "confidence": "80",
10
+ "data_type": "licence",
11
+ "end_date": "2014-12-31",
12
+ "properties": {
13
+ "category": "Business",
14
+ "jurisdiction_classification": [
15
+ "On-Sale Beer and Wine for Bona Fide Public Eating Place"
16
+ ],
17
+ "jurisdiction_code": "us_ca",
18
+ "licence_number": null,
19
+ "status": "ACTIVE"
20
+ },
21
+ "sample_date": "2014-07-16",
22
+ "source_url": "http://www.abc.ca.gov/datport/DataExport.html",
23
+ "start_date": "1981-10-05"
24
+ }
25
+ ]
26
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "source_url": "http://example.com/123",
3
+ "sample_date": "2014-05-29"
4
+ }
@@ -0,0 +1,5 @@
1
+ {
2
+ "source_url": "http://example.com/123",
3
+ "sample_date": "2014-05-29",
4
+ "foo": "bar"
5
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "company_name": "Foo Corporation",
3
+ "company_jurisdiction": "gb",
4
+ "licence_number": "ABC123",
5
+ "jurisdiction_classification": "Bank",
6
+ "licence_jurisdiction": "fr",
7
+ "source_url": "http://example.com/abc123",
8
+ "sample_date": "2014-06-01",
9
+ "confidence": "MEDIUM"
10
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "company_name": "Foo Corporation",
3
+ "company_jurisdiction": "gb",
4
+ "licence_number": "ABC123",
5
+ "jurisdiction_classification": ["Bank", "Robber"],
6
+ "licence_jurisdiction": "fr",
7
+ "source_url": "http://example.com/abc123",
8
+ "sample_date": "2014-06-01",
9
+ "confidence": "MEDIUM"
10
+ }
@@ -0,0 +1,12 @@
1
+ {
2
+ "company_name": "Foo Corporation",
3
+ "company_jurisdiction": "us_ny",
4
+ "category": "Business",
5
+ "licence_number": "ABC123",
6
+ "jurisdiction_classification": "Funeral Parlour",
7
+ "licence_jurisdiction": "New York City",
8
+ "source_url": "http://example.com/abc123",
9
+ "sample_date": "2014-06-01",
10
+ "status": "Delinquent",
11
+ "confidence": "MEDIUM"
12
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "source_url": "http://somewhere.com/a",
3
+ "sample_date": "2014/02/01",
4
+ "start_date": "2014/01/01",
5
+ "end_date": "2015/02/01",
6
+ "confidence": "HIGH",
7
+ "parent_name": "Widgets R US",
8
+ "parent_jurisdiction": "us_de",
9
+ "direct": true,
10
+ "percentage_controlled": "56.6",
11
+ "subsidiary_name": "Little Widgets",
12
+ "subsidiary_jurisdiction": "us_de"
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "source_url": "http://somewhere.com/a",
3
+ "sample_date": "2014/02/01",
4
+ "start_date": "2014/01/01",
5
+ "end_date": "2015/02/01",
6
+ "confidence": "HIGH",
7
+ "parent_name": "Widgets R US",
8
+ "parent_jurisdiction": "us_de",
9
+ "direct": true,
10
+ "percentage_controlled": "56",
11
+ "subsidiary_name": "Little Widgets",
12
+ "subsidiary_jurisdiction": "us_de"
13
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "company": {
3
+ "name": "BP Europa SE",
4
+ "jurisdiction": "Spain"
5
+ },
6
+ "start_date": "2013/07/06",
7
+ "start_date_type": "before",
8
+ "data": [
9
+ {
10
+ "data_type": "subsidiary_relationship",
11
+ "confidence": 80,
12
+ "source_url": "https://docs.google.com/file/d/0B5ORBm2amqZSY2NvOFQwbTZvemM",
13
+ "properties": {
14
+ "direct": true,
15
+ "percentage_controlled": "100",
16
+ "subsidiary": {
17
+ "name": "\"TSG Polska\" Spolka z ograniczona odpowiedzialnocia",
18
+ "jurisdiction": "Poland"
19
+ }
20
+ }
21
+ }
22
+ ]
23
+ }
@@ -0,0 +1,78 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
4
+ # file to always be loaded, without a need to explicitly require it in any files.
5
+ #
6
+ # Given that it is always loaded, you are encouraged to keep this file as
7
+ # light-weight as possible. Requiring heavyweight dependencies from this file
8
+ # will add to the boot time of your test suite on EVERY test run, even for an
9
+ # individual file that may not need all of that loaded. Instead, make a
10
+ # separate helper file that requires this one and then use it only in the specs
11
+ # that actually need it.
12
+ #
13
+ # The `.rspec` file also contains a few flags that are not defaults but that
14
+ # users commonly want.
15
+ #
16
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
17
+ RSpec.configure do |config|
18
+ # The settings below are suggested to provide a good initial experience
19
+ # with RSpec, but feel free to customize to your heart's content.
20
+ =begin
21
+ # These two settings work together to allow you to limit a spec run
22
+ # to individual examples or groups you care about by tagging them with
23
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
24
+ # get run.
25
+ config.filter_run :focus
26
+ config.run_all_when_everything_filtered = true
27
+
28
+ # Many RSpec users commonly either run the entire suite or an individual
29
+ # file, and it's useful to allow more verbose output when running an
30
+ # individual spec file.
31
+ if config.files_to_run.one?
32
+ # Use the documentation formatter for detailed output,
33
+ # unless a formatter has already been configured
34
+ # (e.g. via a command-line flag).
35
+ config.default_formatter = 'doc'
36
+ end
37
+
38
+ # Print the 10 slowest examples and example groups at the
39
+ # end of the spec run, to help surface which specs are running
40
+ # particularly slow.
41
+ config.profile_examples = 10
42
+
43
+ # Run specs in random order to surface order dependencies. If you find an
44
+ # order dependency and want to debug it, you can fix the order by providing
45
+ # the seed, which is printed after each run.
46
+ # --seed 1234
47
+ config.order = :random
48
+
49
+ # Seed global randomization in this process using the `--seed` CLI option.
50
+ # Setting this allows you to use `--seed` to deterministically reproduce
51
+ # test failures related to randomization by passing the same `--seed` value
52
+ # as the one that triggered the failure.
53
+ Kernel.srand config.seed
54
+
55
+ # rspec-expectations config goes here. You can use an alternate
56
+ # assertion/expectation library such as wrong or the stdlib/minitest
57
+ # assertions if you prefer.
58
+ config.expect_with :rspec do |expectations|
59
+ # Enable only the newer, non-monkey-patching expect syntax.
60
+ # For more details, see:
61
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
62
+ expectations.syntax = :expect
63
+ end
64
+
65
+ # rspec-mocks config goes here. You can use an alternate test double
66
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
67
+ config.mock_with :rspec do |mocks|
68
+ # Enable only the newer, non-monkey-patching expect syntax.
69
+ # For more details, see:
70
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
71
+ mocks.syntax = :expect
72
+
73
+ # Prevents you from mocking or stubbing a method that does not exist on
74
+ # a real object. This is generally recommended.
75
+ mocks.verify_partial_doubles = true
76
+ end
77
+ =end
78
+ end
@@ -0,0 +1,39 @@
1
+ require 'json-schema'
2
+ require 'debugger'
3
+
4
+ describe "open-schemas" do
5
+ it "should validate valid json" do
6
+ Dir.glob(File.join('spec','sample-data', 'valid', '*json')).each do |path|
7
+ data = File.open(path) {|f| f.read}
8
+ errors = JSON::Validator.fully_validate(find_schema(path), data, :errors_as_objects => true)
9
+ # debugger unless errors.empty?
10
+ expect(errors).to be_empty, "#{path} was invalid: #{prettify_errors(errors)}"
11
+ end
12
+
13
+ end
14
+
15
+ it "should not validate invalid json" do
16
+ Dir.glob(File.join('spec','sample-data', 'invalid', '*json')).each do |path|
17
+ data = File.open(path) {|f| f.read}
18
+ validation_result = JSON::Validator.validate(find_schema(path), data)
19
+ expect(validation_result).to be_falsy, "Invalid schema #{path} was valid"
20
+ end
21
+ end
22
+ end
23
+
24
+ def find_schema(path)
25
+ filename = File.basename(path)
26
+
27
+ raise "Invalid filename for sample data at #{path}" unless filename =~ /-\d\d\.json$/
28
+
29
+ schema_name = filename.sub(/-\d\d\.json$/, '-schema.json')
30
+ schema_path = File.join('schemas', schema_name)
31
+
32
+ raise "Could not find schema for sample data at #{path}" unless File.exists?(schema_path)
33
+
34
+ schema_path
35
+ end
36
+
37
+ def prettify_errors(errors)
38
+ errors.collect{ |e| e[:message] }.join("\n")
39
+ end
@@ -402,7 +402,7 @@ describe 'a module that includes RegisterMethods' do
402
402
  end
403
403
 
404
404
  it "should check json version of datum against given schema" do
405
- JSON::Validator.should_receive(:fully_validate).with(File.expand_path("../../../../schemas/company-schema.json", __FILE__), @valid_params.to_json, anything)
405
+ JSON::Validator.should_receive(:fully_validate).with(File.expand_path("../../../../schemas/schemas/company-schema.json", __FILE__), @valid_params.to_json, anything)
406
406
  ModuleThatIncludesRegisterMethods.validate_datum(@valid_params)
407
407
  end
408
408
 
@@ -1,11 +1,12 @@
1
1
  # encoding: UTF-8
2
2
  require 'json-schema'
3
+ require 'active_support'
3
4
  require 'active_support/core_ext'
4
- require 'debugger'
5
+ # require 'debugger'
5
6
 
6
7
  describe 'company-schema' do
7
8
  before do
8
- @schema = File.join(File.dirname(__FILE__),'..','..','schemas','company-schema.json')
9
+ @schema = File.join(File.dirname(__FILE__),'..','..','schemas','schemas','company-schema.json')
9
10
  end
10
11
 
11
12
  it "should validate simple company" do
@@ -610,7 +611,7 @@ describe 'company-schema' do
610
611
  end
611
612
  end
612
613
 
613
- it "should not validate if share_parcels are not valid" do
614
+ it "should not validate if total_shares are not valid" do
614
615
  invalid_company_params =
615
616
  [
616
617
  { :name => 'Foo Inc',