puree 0.20.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +16 -2
  3. data/PITCHME.md +43 -21
  4. data/README.md +72 -18
  5. data/lib/puree.rb +66 -21
  6. data/lib/puree/api/api.rb +9 -0
  7. data/lib/puree/api/authentication.rb +33 -0
  8. data/lib/puree/api/configuration.rb +43 -0
  9. data/lib/puree/api/map.rb +76 -0
  10. data/lib/puree/api/request.rb +116 -0
  11. data/lib/puree/extractor/collection.rb +131 -0
  12. data/lib/puree/extractor/dataset.rb +48 -0
  13. data/lib/puree/extractor/download.rb +71 -0
  14. data/lib/puree/extractor/event.rb +33 -0
  15. data/lib/puree/extractor/extractor.rb +10 -0
  16. data/lib/puree/extractor/journal.rb +29 -0
  17. data/lib/puree/extractor/organisation.rb +34 -0
  18. data/lib/puree/extractor/person.rb +32 -0
  19. data/lib/puree/extractor/project.rb +40 -0
  20. data/lib/puree/extractor/publication.rb +40 -0
  21. data/lib/puree/extractor/publisher.rb +27 -0
  22. data/lib/puree/extractor/resource.rb +69 -0
  23. data/lib/puree/extractor/server.rb +56 -0
  24. data/lib/puree/model/address.rb +50 -0
  25. data/lib/puree/model/copyright_license.rb +26 -0
  26. data/lib/puree/model/dataset.rb +84 -0
  27. data/lib/puree/model/download_header.rb +21 -0
  28. data/lib/puree/model/endeavour_person.rb +34 -0
  29. data/lib/puree/model/event.rb +31 -0
  30. data/lib/puree/model/event_header.rb +26 -0
  31. data/lib/puree/model/file.rb +45 -0
  32. data/lib/puree/model/helper/validation.rb +15 -0
  33. data/lib/puree/model/journal.rb +20 -0
  34. data/lib/puree/model/legal_condition.rb +26 -0
  35. data/lib/puree/model/link.rb +26 -0
  36. data/lib/puree/model/model.rb +7 -0
  37. data/lib/puree/model/organisation.rb +34 -0
  38. data/lib/puree/model/organisation_header.rb +34 -0
  39. data/lib/puree/model/person.rb +28 -0
  40. data/lib/puree/model/person_name.rb +52 -0
  41. data/lib/puree/model/project.rb +49 -0
  42. data/lib/puree/model/publication.rb +53 -0
  43. data/lib/puree/model/publication_status.rb +21 -0
  44. data/lib/puree/model/publisher.rb +13 -0
  45. data/lib/puree/model/related_content_header.rb +34 -0
  46. data/lib/puree/model/resource.rb +42 -0
  47. data/lib/puree/model/server.rb +13 -0
  48. data/lib/puree/model/spatial_point.rb +16 -0
  49. data/lib/puree/model/structure.rb +18 -0
  50. data/lib/puree/model/temporal_range.rb +15 -0
  51. data/lib/puree/util/date.rb +86 -0
  52. data/lib/puree/util/util.rb +8 -0
  53. data/lib/puree/version.rb +1 -1
  54. data/lib/puree/xml_extractor/base.rb +47 -0
  55. data/lib/puree/xml_extractor/collection.rb +40 -0
  56. data/lib/puree/xml_extractor/dataset.rb +305 -0
  57. data/lib/puree/xml_extractor/download.rb +42 -0
  58. data/lib/puree/xml_extractor/event.rb +63 -0
  59. data/lib/puree/xml_extractor/journal.rb +33 -0
  60. data/lib/puree/xml_extractor/organisation.rb +75 -0
  61. data/lib/puree/xml_extractor/person.rb +57 -0
  62. data/lib/puree/xml_extractor/project.rb +135 -0
  63. data/lib/puree/xml_extractor/publication.rb +189 -0
  64. data/lib/puree/xml_extractor/publisher.rb +28 -0
  65. data/lib/puree/xml_extractor/resource.rb +71 -0
  66. data/lib/puree/xml_extractor/server.rb +32 -0
  67. data/lib/puree/xml_extractor/shared.rb +31 -0
  68. data/lib/puree/xml_extractor/xml_extractor.rb +10 -0
  69. data/puree.gemspec +11 -8
  70. data/spec/download_http_spec.rb +31 -0
  71. data/spec/open_api_dataset_http_spec.rb +15 -0
  72. data/spec/resource/collection_all_http_spec.rb +77 -0
  73. data/spec/resource/collection_http_spec.rb +65 -0
  74. data/spec/resource/dataset_http_spec.rb +104 -0
  75. data/spec/resource/event_http_spec.rb +52 -0
  76. data/spec/resource/journal_http_spec.rb +36 -0
  77. data/spec/resource/organisation_http_spec.rb +52 -0
  78. data/spec/resource/person_http_spec.rb +48 -0
  79. data/spec/resource/project_http_spec.rb +76 -0
  80. data/spec/resource/publication_http_spec.rb +78 -0
  81. data/spec/resource/publisher_http_spec.rb +26 -0
  82. data/spec/server_http_spec.rb +26 -0
  83. data/spec/spec_helper.rb +106 -21
  84. metadata +110 -46
  85. data/lib/puree/collection.rb +0 -285
  86. data/lib/puree/configuration.rb +0 -15
  87. data/lib/puree/dataset.rb +0 -483
  88. data/lib/puree/date.rb +0 -63
  89. data/lib/puree/download.rb +0 -189
  90. data/lib/puree/event.rb +0 -133
  91. data/lib/puree/journal.rb +0 -75
  92. data/lib/puree/map.rb +0 -68
  93. data/lib/puree/organisation.rb +0 -177
  94. data/lib/puree/person.rb +0 -136
  95. data/lib/puree/project.rb +0 -231
  96. data/lib/puree/publication.rb +0 -258
  97. data/lib/puree/publisher.rb +0 -64
  98. data/lib/puree/resource.rb +0 -261
  99. data/lib/puree/server.rb +0 -156
  100. data/spec/collection_spec.rb +0 -62
  101. data/spec/dataset_spec.rb +0 -148
  102. data/spec/download_spec.rb +0 -33
  103. data/spec/event_spec.rb +0 -108
  104. data/spec/journal_spec.rb +0 -92
  105. data/spec/organisation_spec.rb +0 -112
  106. data/spec/person_spec.rb +0 -104
  107. data/spec/project_spec.rb +0 -120
  108. data/spec/publication_spec.rb +0 -128
  109. data/spec/publisher_spec.rb +0 -89
  110. data/spec/server_spec.rb +0 -36
@@ -1,89 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Publisher' do
4
-
5
- def request
6
- base_url = ENV['PURE_BASE_URL']
7
- username = ENV['PURE_USERNAME']
8
- password = ENV['PURE_PASSWORD']
9
- @uuid = ENV['PURE_PUBLISHER_UUID']
10
- @p = Puree::Publisher.new(base_url: base_url,
11
- username: username,
12
- password: password,
13
- basic_auth: true)
14
- @metadata = @p.find uuid: @uuid
15
- end
16
-
17
- it '#new' do
18
- p = Puree::Publisher.new
19
- expect(p).to be_an_instance_of Puree::Publisher
20
- end
21
-
22
- describe 'data retrieval' do
23
- before(:all) do
24
- request
25
- end
26
-
27
- it '#find' do
28
- expect(@metadata).to be_an_instance_of(Hash)
29
- end
30
-
31
- it '#created' do
32
- expect(@p.created).to be_an_instance_of(String)
33
- end
34
-
35
- it '#locale' do
36
- expect(@p.locale).to be_an_instance_of(String)
37
- end
38
-
39
- it '#metadata' do
40
- expect(@p.metadata).to be_an_instance_of(Hash)
41
- end
42
-
43
- it '#metadata' do
44
- expect(@p.metadata).not_to be_empty
45
- end
46
-
47
- it '#modified' do
48
- expect(@p.modified).to be_an_instance_of(String)
49
- end
50
-
51
- it '#name' do
52
- expect(@p.name).to be_an_instance_of(String)
53
- end
54
-
55
- # Adds no value as value is Publisher
56
- # it '#type' do
57
- # expect(@p.type).to be_an_instance_of(String)
58
- # end
59
-
60
- it '#uuid' do
61
- expect(@p.uuid).to be_an_instance_of(String)
62
- end
63
- end
64
-
65
- describe 'data retrieval from file' do
66
- before(:all) do
67
- request
68
-
69
- filename = "#{ENV['PURE_FILE_PATH']}publisher.#{@uuid}.xml"
70
- File.write(filename, @p.response.body)
71
-
72
- @metadata = @p.set_content File.read(filename)
73
- end
74
-
75
- it '#set_content' do
76
- expect(@metadata).to be_an_instance_of(Hash)
77
- end
78
-
79
- it '#metadata' do
80
- expect(@p.metadata).to be_an_instance_of(Hash)
81
- end
82
-
83
- it '#metadata' do
84
- expect(@p.metadata).not_to be_empty
85
- end
86
-
87
- end
88
-
89
- end
data/spec/server_spec.rb DELETED
@@ -1,36 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe 'Server' do
4
-
5
- it '#new' do
6
- p = Puree::Server.new
7
- expect(p).to be_an_instance_of Puree::Server
8
- end
9
-
10
- describe 'data retrieval' do
11
- before(:all) do
12
- base_url = ENV['PURE_BASE_URL']
13
- username = ENV['PURE_USERNAME']
14
- password = ENV['PURE_PASSWORD']
15
- @p = Puree::Server.new(base_url: base_url,
16
- username: username,
17
- password: password,
18
- basic_auth: true)
19
- @metadata = @p.find
20
- end
21
-
22
- it '#find' do
23
- expect(@metadata).to be_an_instance_of(Hash)
24
- end
25
-
26
- it '#find' do
27
- expect(@metadata).not_to be_empty
28
- end
29
-
30
- it '#version' do
31
- expect(@p.version).to be_an_instance_of(String)
32
- end
33
-
34
- end
35
-
36
- end