certificate-factory 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +15 -0
  2. data/.gitignore +3 -0
  3. data/.ruby-version +1 -0
  4. data/.travis.yml +19 -0
  5. data/Gemfile +6 -0
  6. data/Gemfile.lock +154 -0
  7. data/LICENSE.md +10 -0
  8. data/README.md +54 -0
  9. data/Rakefile +114 -0
  10. data/certificate-factory.gemspec +33 -0
  11. data/env.example +3 -0
  12. data/lib/certificate-factory.rb +14 -0
  13. data/lib/certificate-factory/api.rb +19 -0
  14. data/lib/certificate-factory/certificate.rb +112 -0
  15. data/lib/certificate-factory/factory.rb +89 -0
  16. data/lib/certificate-factory/version.rb +3 -0
  17. data/spec/api_spec.rb +12 -0
  18. data/spec/cassettes/CertificateFactory_API/returns_the_correct_URL_for_a_dataset.yml +107 -0
  19. data/spec/cassettes/CertificateFactory_Certificate/keeps_trying_for_a_result_until_it_gets_one.yml +64 -0
  20. data/spec/cassettes/CertificateFactory_Certificate/requests_and_gets_a_certificate.yml +781 -0
  21. data/spec/cassettes/CertificateFactory_Certificate/requests_certificate_creation.yml +39 -0
  22. data/spec/cassettes/CertificateFactory_Certificate/returns_an_error_if_dataset_already_exists.yml +106 -0
  23. data/spec/cassettes/CertificateFactory_Factory/builds_certificates_correctly.yml +726 -0
  24. data/spec/cassettes/CertificateFactory_Factory/creates_the_correct_number_of_certificates_going_over_multiple_pages.yml +4900 -0
  25. data/spec/cassettes/CertificateFactory_Factory/creates_the_correct_number_of_certificates_when_querying_a_single_page.yml +696 -0
  26. data/spec/cassettes/CertificateFactory_Factory/stops_when_it_gets_to_the_end_of_a_feed.yml +126 -0
  27. data/spec/certificate_spec.rb +93 -0
  28. data/spec/factory_spec.rb +88 -0
  29. data/spec/fixtures/certificate.json +1 -0
  30. data/spec/fixtures/feed.atom +97 -0
  31. data/spec/fixtures/one-page.atom +23 -0
  32. data/spec/fixtures/single-feed-1.atom +26 -0
  33. data/spec/fixtures/single-feed-2.atom +32 -0
  34. data/spec/fixtures/single-feed.atom +24 -0
  35. data/spec/spec_helper.rb +43 -0
  36. metadata +254 -0
@@ -0,0 +1,32 @@
1
+ <feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom">
2
+ <title>DGU - Custom query</title>
3
+ <link href="http://data.gov.uk/data/search" rel="alternate"/>
4
+ <link href="http://data.gov.uk/feeds/custom.atom" rel="self"/>
5
+ <id>tag:data.gov.uk,2012:/feeds/custom.atom?core_dataset=false&amp;unpublished=false&amp;license_id-is-ogl=true</id>
6
+ <updated>2014-09-11T09:21:30Z</updated>
7
+ <author>
8
+ <name>co-prod3.dh.bytemark.co.uk</name>
9
+ <uri>http://data.gov.uk</uri>
10
+ </author>
11
+ <subtitle>Recently created or updated datasets on DGU. Custom query: ''</subtitle>
12
+ <link href="http://data.gov.uk/feeds/custom.atom?page=4" rel="next"/>
13
+ <link href="http://data.gov.uk/feeds/custom.atom" rel="first"/>
14
+ <link href="http://data.gov.uk/feeds/custom.atom?page=563" rel="last"/>
15
+ <entry>
16
+ <title>GP Earnings and Expenses</title>
17
+ <link href="http://data.gov.uk/dataset/bf40345c-06dd-4fcf-b33c-a77c9fc56ea1" rel="alternate"/>
18
+ <id>tag:data.gov.uk,2012:/dataset/bf40345c-06dd-4fcf-b33c-a77c9fc56ea1</id>
19
+ <summary type="html">The report presents results of the GP Earnings and Expenses Enquiry. It provides a detailed study of the earnings and expenses in the UK and has been agreed by the Technical Steering Committee.Source agency: Health and Social Care Information CentreDesignation: Official Statistics not designated as National StatisticsLanguage: EnglishAlternative title: GP Earnings and Expenses</summary>
20
+ <link length="45795" href="http://data.gov.uk/api/2/rest/package/gp_earnings_and_expenses" type="application/json" rel="enclosure"/>
21
+ <category term="care"/>
22
+ <category term="earnings"/>
23
+ <category term="general-practice-services"/>
24
+ <category term="health"/>
25
+ <category term="health-and-social-care"/>
26
+ <category term="nhs"/>
27
+ <category term="specialist-health-services"/>
28
+ <category term="well-being-and-care"/>
29
+ <updated>2014-09-19T08:40:12Z</updated>
30
+ <published>2011-12-11T00:10:46Z</published>
31
+ </entry>
32
+ </feed>
@@ -0,0 +1,24 @@
1
+ <feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom">
2
+ <title>DGU - Custom query</title>
3
+ <link href="http://data.gov.uk/data/search" rel="alternate"/>
4
+ <link href="http://data.gov.uk/feeds/custom.atom" rel="self"/>
5
+ <id>tag:data.gov.uk,2012:/feeds/custom.atom?core_dataset=false&amp;unpublished=false&amp;license_id-is-ogl=true</id>
6
+ <updated>2014-09-11T09:21:30Z</updated>
7
+ <author>
8
+ <name>co-prod3.dh.bytemark.co.uk</name>
9
+ <uri>http://data.gov.uk</uri>
10
+ </author>
11
+ <subtitle>Recently created or updated datasets on DGU. Custom query: ''</subtitle>
12
+ <link href="http://data.gov.uk/feeds/custom.atom?page=2" rel="next"/>
13
+ <link href="http://data.gov.uk/feeds/custom.atom" rel="first"/>
14
+ <link href="http://data.gov.uk/feeds/custom.atom?page=563" rel="last"/>
15
+ <entry>
16
+ <title>Cambridgeshire County Council Management Band pay scales</title>
17
+ <link href="http://data.gov.uk/dataset/4820b7ee-e960-4d65-9bbd-bf05fdd5dd26" rel="alternate"/>
18
+ <id>tag:data.gov.uk,2012:/dataset/4820b7ee-e960-4d65-9bbd-bf05fdd5dd26</id>
19
+ <summary type="html">This dataset contains the pay scale for Management Band roles within Cambridgeshire County Council.</summary>
20
+ <link length="13307" href="http://data.gov.uk/api/2/rest/package/cambridgeshire-county-council-management-band-pay-scales" type="application/json" rel="enclosure"/>
21
+ <updated>2014-09-11T08:45:05Z</updated>
22
+ <published>2014-09-11T08:45:05Z</published>
23
+ </entry>
24
+ </feed>
@@ -0,0 +1,43 @@
1
+ ENV['BASE_URI'] = "http://open-data-certificate.dev"
2
+ ENV['ODC_USERNAME'] = "api@example.com"
3
+ ENV['ODC_API_KEY'] = "Ra1v78QHDCpbu1Pq2XCJ"
4
+
5
+ require 'simplecov'
6
+ require 'simplecov-rcov'
7
+ require 'certificate-factory'
8
+ require 'pry'
9
+ require 'webmock/rspec'
10
+ require 'coveralls'
11
+ require 'vcr'
12
+
13
+ Coveralls.wear_merged!
14
+
15
+ VCR.configure do |c|
16
+ ignore_env = %w{SHLVL RUNLEVEL GUARD_NOTIFY DRB COLUMNS USER LOGNAME LINES TERM_PROGRAM_VERSION}
17
+ (ENV.keys-ignore_env).select{|x| x =~ /\A[A-Z_]*\Z/}.each do |key|
18
+ c.filter_sensitive_data("<#{key}>") { ENV[key] }
19
+ end
20
+ c.cassette_library_dir = 'spec/cassettes'
21
+ c.default_cassette_options = { :record => :once }
22
+ c.hook_into :webmock
23
+ c.configure_rspec_metadata!
24
+ end
25
+
26
+ RSpec.configure do |config|
27
+ config.run_all_when_everything_filtered = true
28
+ config.filter_run :focus
29
+
30
+ config.before(:each) do
31
+ allow_any_instance_of(CertificateFactory::Certificate).to receive(:sleep)
32
+ end
33
+
34
+ # Run specs in random order to surface order dependencies. If you find an
35
+ # order dependency and want to debug it, you can fix the order by providing
36
+ # the seed, which is printed after each run.
37
+ # --seed 1234
38
+ config.order = 'random'
39
+ end
40
+
41
+ def load_fixture(file)
42
+ File.read( File.join( File.dirname(File.realpath(__FILE__)) , "fixtures", file ) )
43
+ end
metadata ADDED
@@ -0,0 +1,254 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: certificate-factory
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Stuart Harrison
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-07-18 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: httparty
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: dotenv
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ! '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ! '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rake
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ! '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ! '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: simplecov
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ! '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: simplecov-rcov
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ! '>='
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ! '>='
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: coveralls
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ! '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ! '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ! '>='
123
+ - !ruby/object:Gem::Version
124
+ version: '0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: webmock
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ! '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ! '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: vcr
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ - !ruby/object:Gem::Dependency
154
+ name: pry-remote
155
+ requirement: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ type: :development
161
+ prerelease: false
162
+ version_requirements: !ruby/object:Gem::Requirement
163
+ requirements:
164
+ - - ! '>='
165
+ - !ruby/object:Gem::Version
166
+ version: '0'
167
+ description: Automagically generate Open Data Certificates from a CKAN Dataset or
168
+ Data.gov.uk atom feed.
169
+ email:
170
+ - tech@theodi.org
171
+ executables: []
172
+ extensions: []
173
+ extra_rdoc_files: []
174
+ files:
175
+ - .gitignore
176
+ - .ruby-version
177
+ - .travis.yml
178
+ - Gemfile
179
+ - Gemfile.lock
180
+ - LICENSE.md
181
+ - README.md
182
+ - Rakefile
183
+ - certificate-factory.gemspec
184
+ - env.example
185
+ - lib/certificate-factory.rb
186
+ - lib/certificate-factory/api.rb
187
+ - lib/certificate-factory/certificate.rb
188
+ - lib/certificate-factory/factory.rb
189
+ - lib/certificate-factory/version.rb
190
+ - spec/api_spec.rb
191
+ - spec/cassettes/CertificateFactory_API/returns_the_correct_URL_for_a_dataset.yml
192
+ - spec/cassettes/CertificateFactory_Certificate/keeps_trying_for_a_result_until_it_gets_one.yml
193
+ - spec/cassettes/CertificateFactory_Certificate/requests_and_gets_a_certificate.yml
194
+ - spec/cassettes/CertificateFactory_Certificate/requests_certificate_creation.yml
195
+ - spec/cassettes/CertificateFactory_Certificate/returns_an_error_if_dataset_already_exists.yml
196
+ - spec/cassettes/CertificateFactory_Factory/builds_certificates_correctly.yml
197
+ - spec/cassettes/CertificateFactory_Factory/creates_the_correct_number_of_certificates_going_over_multiple_pages.yml
198
+ - spec/cassettes/CertificateFactory_Factory/creates_the_correct_number_of_certificates_when_querying_a_single_page.yml
199
+ - spec/cassettes/CertificateFactory_Factory/stops_when_it_gets_to_the_end_of_a_feed.yml
200
+ - spec/certificate_spec.rb
201
+ - spec/factory_spec.rb
202
+ - spec/fixtures/certificate.json
203
+ - spec/fixtures/feed.atom
204
+ - spec/fixtures/one-page.atom
205
+ - spec/fixtures/single-feed-1.atom
206
+ - spec/fixtures/single-feed-2.atom
207
+ - spec/fixtures/single-feed.atom
208
+ - spec/spec_helper.rb
209
+ homepage: http://theodi.org
210
+ licenses:
211
+ - MIT
212
+ metadata: {}
213
+ post_install_message:
214
+ rdoc_options: []
215
+ require_paths:
216
+ - lib
217
+ - app
218
+ required_ruby_version: !ruby/object:Gem::Requirement
219
+ requirements:
220
+ - - ! '>='
221
+ - !ruby/object:Gem::Version
222
+ version: '0'
223
+ required_rubygems_version: !ruby/object:Gem::Requirement
224
+ requirements:
225
+ - - ! '>='
226
+ - !ruby/object:Gem::Version
227
+ version: '0'
228
+ requirements: []
229
+ rubyforge_project:
230
+ rubygems_version: 2.4.5
231
+ signing_key:
232
+ specification_version: 4
233
+ summary: Automagically generate Open Data Certificates from a CKAN Dataset or Data.gov.uk
234
+ atom feed.
235
+ test_files:
236
+ - spec/api_spec.rb
237
+ - spec/cassettes/CertificateFactory_API/returns_the_correct_URL_for_a_dataset.yml
238
+ - spec/cassettes/CertificateFactory_Certificate/keeps_trying_for_a_result_until_it_gets_one.yml
239
+ - spec/cassettes/CertificateFactory_Certificate/requests_and_gets_a_certificate.yml
240
+ - spec/cassettes/CertificateFactory_Certificate/requests_certificate_creation.yml
241
+ - spec/cassettes/CertificateFactory_Certificate/returns_an_error_if_dataset_already_exists.yml
242
+ - spec/cassettes/CertificateFactory_Factory/builds_certificates_correctly.yml
243
+ - spec/cassettes/CertificateFactory_Factory/creates_the_correct_number_of_certificates_going_over_multiple_pages.yml
244
+ - spec/cassettes/CertificateFactory_Factory/creates_the_correct_number_of_certificates_when_querying_a_single_page.yml
245
+ - spec/cassettes/CertificateFactory_Factory/stops_when_it_gets_to_the_end_of_a_feed.yml
246
+ - spec/certificate_spec.rb
247
+ - spec/factory_spec.rb
248
+ - spec/fixtures/certificate.json
249
+ - spec/fixtures/feed.atom
250
+ - spec/fixtures/one-page.atom
251
+ - spec/fixtures/single-feed-1.atom
252
+ - spec/fixtures/single-feed-2.atom
253
+ - spec/fixtures/single-feed.atom
254
+ - spec/spec_helper.rb