dbla 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b511243621c7428086b96e4b807c3900dddd1264
4
- data.tar.gz: c46a5e41a85489dd58e189adc67859699bd7adb8
3
+ metadata.gz: 7ec4c36f34bce118a8f7742e32040622e68c76d8
4
+ data.tar.gz: 44f112fa2dd872c43aaa9c93394c5f995a4ce733
5
5
  SHA512:
6
- metadata.gz: 54793d19643fd0c7854c1ef8f1e98720ea0c4b46ad1493265ae6bef4527369ff060e7a6d0914c2ea4fcc526ec21337fe21a60e5af72c736fda9edbbfd4f0fcec
7
- data.tar.gz: 54a4c98894f0e24f4b1fbeb868b10b1941402bb2b9d1174bf82567a4af5c093672b6dfbe5795b9057119a8ff67c879cbad2893f3193a0b8db08f99a71263f836
6
+ metadata.gz: fef1b5003cbb9895b39ec794e9eece9e5dfeb4bfd173c7d48e40fc9a80f9b1007b82fb657a18ae408595a2d2533140fd9ad62bb4b4c7dae72647e1e3b72155a5
7
+ data.tar.gz: 0b86c1b40dd2cae506feb38ec78dcae7e53d048e6bd6160895e75eb80bcae7ae65a4816bf6909f6032afa20633e4b4c1f86316f3aa7f09722659d770d083cdc3
data/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2015 YOURNAME
1
+ Copyright 2015 Audrey Altman, Ben Armintor, Jeremy Friesen
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,36 +1,60 @@
1
1
  = Dbla
2
2
 
3
+ Access [DPLA](http://dp.la)'s API via the [Blacklight](http://projectblacklight.org/) search interface.
4
+
5
+ ## Installation
6
+
3
7
  1. Generate a Blacklight app:
4
- ```
5
- rails new search_app -m https://raw.github.com/projectblacklight/blacklight/master/template.demo.rb
6
- cd search_app
8
+
9
+ ```console
10
+ $ rails new search_app -m https://raw.github.com/projectblacklight/blacklight/master/template.demo.rb
11
+ $ cd search_app
7
12
  ```
8
13
 
9
14
  2. Add the dbla gem to the Gemfile:
10
- ```
15
+
16
+ ```ruby
11
17
  gem "dbla"
12
18
  ```
13
19
  and bundle install.
14
20
 
15
21
  3. Run the dbla generators:
16
- ```
17
- rails g dbla:install
18
- ```
19
22
 
20
- 4. Create a config/dpla.yml file of the form:
23
+ ```console
24
+ $ rails g dbla:install
21
25
  ```
22
- api_key: 00000000
23
- api_email: ab@dp.la
26
+
27
+ 4. Create a config/dpla.yml file of the form
28
+
29
+ ```yml
30
+ api_key: <your-api-key
31
+ api_email: <your-email-that-you-used-for-your-api-key>
24
32
  url: http://api.dp.la/v2/
25
33
  ```
34
+
35
+ Find out how to [request your DPLA API key](http://dp.la/info/developers/codex/policies/#get-a-key)
36
+
26
37
  This file can be stubbed out with a rake task:
38
+
39
+ ```console
40
+ $ rake dbla:key:get email=my.email@my.server.org
41
+ # get your email from DPLA
42
+ $ rake dbla:key:config key=YOURKEY00000000
27
43
  ```
28
- rake dbla:key:get email=my.email@my.server.org
29
- # get your email
30
- rake dbla:key:config key=YOURKEY00000000
31
- ```
44
+
32
45
  5. Configure the CatalogController
46
+
47
+ Replace the following code in your CatalogController:
48
+
49
+ ```ruby
50
+ # solr field configuration for search results/index views
51
+ config.index.title_field = 'title_display'
52
+ config.index.display_type_field = 'format'
33
53
  ```
54
+
55
+ With the Dbla options.
56
+
57
+ ```ruby
34
58
  config.repository_class = Dbla::Repository
35
59
  config.document_model = Item
36
60
  config.response_model = Dbla::Response
@@ -42,8 +66,11 @@ rake dbla:key:config key=YOURKEY00000000
42
66
  ```
43
67
 
44
68
  6. Fire it up!
45
- ``` rails s```
46
69
 
47
- Go to localhost:3000
70
+ ```console
71
+ $ rails s
72
+ ```
73
+
74
+ Open your browser and go to [localhost:3000](http://localhost:3000).
48
75
 
49
76
  Search for kittens!
data/Rakefile CHANGED
@@ -14,21 +14,11 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
- APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
17
+ APP_RAKEFILE = File.expand_path("../spec/dummy/Rakefile", __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
-
21
-
22
20
  Bundler::GemHelper.install_tasks
23
21
 
24
- require 'rake/testtask'
25
-
26
- Rake::TestTask.new(:test) do |t|
27
- t.libs << 'lib'
28
- t.libs << 'test'
29
- t.pattern = 'test/**/*_test.rb'
30
- t.verbose = false
31
- end
32
-
22
+ require 'rspec/core/rake_task'
33
23
 
34
- task default: :test
24
+ task default: 'app:spec'
@@ -14,15 +14,11 @@ module Dbla
14
14
  header['params'] || request_params
15
15
  end
16
16
 
17
- def start
18
- @start
19
- end
20
-
21
- def rows
22
- @limit
23
- end
17
+ alias_method :rows, :limit
24
18
 
25
19
  def sort
20
+ # REVIEW: There are mixed style key accesses (strings and symbols);
21
+ # Could/Should this be "normalized"?
26
22
  params[:sort]
27
23
  end
28
24
 
@@ -1,3 +1,3 @@
1
1
  module Dbla
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -4,9 +4,9 @@ module Dbla
4
4
  module ApiKey
5
5
  RESOURCE = 'http://api.dp.la/v2/api_key/'.freeze
6
6
  USAGE = {
7
- get: " rake Dbla:key:get email=YOUR.EMAIL@SERVER.ORG",
8
- config: " rake Dbla:key:config key=YOURKEY000000000000000000000000",
9
- report: " rake Dbla:key:report",
7
+ get: " rake dbla:key:get email=YOUR.EMAIL@SERVER.ORG",
8
+ config: " rake dbla:key:config key=YOURKEY000000000000000000000000",
9
+ report: " rake dbla:key:report",
10
10
  }
11
11
  def self.usage(key=:all)
12
12
  puts "Usage:"
@@ -18,7 +18,7 @@ namespace :dbla do
18
18
  namespace :key do
19
19
  task get: :environment do
20
20
  if ENV['email']
21
- uri = URI(RESOURCE + email)
21
+ uri = URI(Dbla::ApiKey::RESOURCE + ENV['email'])
22
22
  Net::HTTP.start(uri.host, uri.port) do |http|
23
23
  request = Net::HTTP::Post.new uri
24
24
  response = http.request request
@@ -43,8 +43,10 @@ namespace :dbla do
43
43
  end
44
44
  task config: :environment do
45
45
  if ENV['key']
46
- open(Dbla.config_path,'a') do |blob|
47
- blob.write YAML.dump('api_key' => ENV['key'])
46
+ config = YAML.load(File.read(Dbla.config_path))
47
+ config['api_key'] = ENV['key']
48
+ open(Dbla.config_path,'w') do |blob|
49
+ blob.write YAML.dump(config)
48
50
  end
49
51
  else
50
52
  Dbla::ApiKey.usage(:config)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dbla
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Audrey Altman