umlaut-primo 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (56) hide show
  1. data/MIT-LICENSE +20 -0
  2. data/README.md +10 -0
  3. data/Rakefile +35 -0
  4. data/lib/umlaut_primo/primo_service.rb +522 -0
  5. data/lib/umlaut_primo/primo_source.rb +59 -0
  6. data/lib/umlaut_primo/version.rb +3 -0
  7. data/lib/umlaut_primo.rb +2 -0
  8. data/test/dummy/Rakefile +7 -0
  9. data/test/dummy/app/assets/images/rails.png +0 -0
  10. data/test/dummy/app/assets/javascripts/application.js +15 -0
  11. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  12. data/test/dummy/app/controllers/application_controller.rb +3 -0
  13. data/test/dummy/app/controllers/umlaut_controller.rb +122 -0
  14. data/test/dummy/app/helpers/application_helper.rb +2 -0
  15. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  16. data/test/dummy/config/application.rb +63 -0
  17. data/test/dummy/config/boot.rb +6 -0
  18. data/test/dummy/config/database.yml +61 -0
  19. data/test/dummy/config/environment.rb +5 -0
  20. data/test/dummy/config/environments/development.rb +41 -0
  21. data/test/dummy/config/environments/production.rb +67 -0
  22. data/test/dummy/config/environments/test.rb +37 -0
  23. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  24. data/test/dummy/config/initializers/inflections.rb +15 -0
  25. data/test/dummy/config/initializers/mime_types.rb +5 -0
  26. data/test/dummy/config/initializers/secret_token.rb +7 -0
  27. data/test/dummy/config/initializers/session_store.rb +8 -0
  28. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  29. data/test/dummy/config/locales/en.yml +5 -0
  30. data/test/dummy/config/primo.yml +55 -0
  31. data/test/dummy/config/routes.rb +60 -0
  32. data/test/dummy/config/umlaut_services.yml +29 -0
  33. data/test/dummy/config.ru +4 -0
  34. data/test/dummy/db/migrate/20130306173028_umlaut_init.umlaut.rb +106 -0
  35. data/test/dummy/db/migrate/20130306173029_umlaut_add_service_response_index.umlaut.rb +10 -0
  36. data/test/dummy/db/schema.rb +118 -0
  37. data/test/dummy/db/seeds.rb +7 -0
  38. data/test/dummy/log/development.log +4 -0
  39. data/test/dummy/log/test.log +19611 -0
  40. data/test/dummy/public/404.html +26 -0
  41. data/test/dummy/public/422.html +26 -0
  42. data/test/dummy/public/500.html +25 -0
  43. data/test/dummy/public/favicon.ico +0 -0
  44. data/test/dummy/public/robots.txt +5 -0
  45. data/test/dummy/script/rails +6 -0
  46. data/test/fixtures/referent_values.yml +96 -0
  47. data/test/fixtures/referents.yml +12 -0
  48. data/test/fixtures/requests.yml +20 -0
  49. data/test/fixtures/sfx_urls.yml +4 -0
  50. data/test/test_helper.rb +30 -0
  51. data/test/unit/primo_service_test.rb +228 -0
  52. data/test/unit/primo_source_test.rb +78 -0
  53. data/test/vcr_cassettes/australian_journal_of_international_affairs_by_id.yml +284 -0
  54. data/test/vcr_cassettes/musical_quarterly_by_issn.yml +263 -0
  55. data/test/vcr_cassettes/travels_with_my_by_id.yml +167 -0
  56. metadata +284 -0
@@ -0,0 +1,29 @@
1
+ # Configure what service plugins are used by Umlaut. This skeleton file
2
+ # has been generated into your app to help you get started.
3
+ #
4
+ # If a service has "disabled:true", it's currently turned off.
5
+ #
6
+ # Some services require local api key or connection details as config.
7
+ # Most services take other options for custom configuration too, not
8
+ # all options are neccesarily listed as examples here, see source
9
+ # or source-generated docs for more info.
10
+ default:
11
+ services:
12
+ Primo:
13
+ priority: 1
14
+ type: PrimoService
15
+ base_url: http://bobcat.library.nyu.edu
16
+ vid: NYU
17
+ institution: NYU
18
+ holding_search_institution: NYU
19
+ holding_search_text: Search for this title in Primo.
20
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.edu\/login\?url=/'
21
+
22
+ PrimoSource:
23
+ priority: 2
24
+ base_url: http://bobcat.library.nyu.edu
25
+ vid: NYU
26
+ institution: NYU
27
+ holding_search_institution: NYU
28
+ holding_search_text: Search for this title in Primo.
29
+ ez_proxy: !ruby/regexp '/https\:\/\/ezproxy\.library\.edu\/login\?url=/'
@@ -0,0 +1,4 @@
1
+ # This file is used by Rack-based servers to start the application.
2
+
3
+ require ::File.expand_path('../config/environment', __FILE__)
4
+ run Dummy::Application
@@ -0,0 +1,106 @@
1
+ # This migration comes from umlaut (originally 1)
2
+ class UmlautInit < ActiveRecord::Migration
3
+ def change
4
+ create_table "clickthroughs" do |t|
5
+ t.integer "request_id", :default => 0, :null => false
6
+ t.integer "service_response_id", :default => 0, :null => false
7
+ t.datetime "created_at", :null => false
8
+ end
9
+
10
+ add_index "clickthroughs", ["created_at"], :name => "click_created_idx"
11
+ add_index "clickthroughs", ["request_id"], :name => "click_req_id"
12
+ add_index "clickthroughs", ["service_response_id"], :name => "click_serv_resp_idx"
13
+
14
+ create_table "dispatched_services" do |t|
15
+ t.integer "request_id", :default => 0, :null => false
16
+ t.string "service_id", :default => "0", :null => false
17
+ t.datetime "updated_at", :null => false
18
+ t.text "exception_info"
19
+ t.string "status", :null => false
20
+ t.datetime "created_at"
21
+ end
22
+
23
+ add_index "dispatched_services", ["request_id", "service_id"], :name => "dptch_request_id"
24
+
25
+ create_table "permalinks" do |t|
26
+ t.integer "referent_id", :default => 0
27
+ t.date "created_on", :null => false
28
+ t.text "context_obj_serialized"
29
+ t.string "orig_rfr_id", :limit => 256
30
+ t.date "last_access"
31
+ end
32
+
33
+ add_index "permalinks", ["referent_id"], :name => "plink_referent_idx"
34
+
35
+ create_table "referent_values" do |t|
36
+ t.integer "referent_id", :default => 0, :null => false
37
+ t.string "key_name", :limit => 50, :default => "", :null => false
38
+ t.text "value"
39
+ t.string "normalized_value"
40
+ t.boolean "metadata", :default => false, :null => false
41
+ t.boolean "private_data", :default => false, :null => false
42
+ t.datetime "created_at"
43
+ end
44
+
45
+ add_index "referent_values", ["key_name", "normalized_value"], :name => "by_name_and_normal_val"
46
+ add_index "referent_values", ["referent_id", "key_name", "normalized_value"], :name => "rft_val_referent_idx"
47
+
48
+ create_table "referents" do |t|
49
+ t.string "atitle"
50
+ t.string "title"
51
+ t.string "issn", :limit => 10
52
+ t.string "isbn", :limit => 13
53
+ t.string "year", :limit => 4
54
+ t.string "volume", :limit => 10
55
+ t.datetime "created_at"
56
+ end
57
+
58
+ add_index "referents", ["atitle", "title", "issn", "isbn", "year", "volume"], :name => "rft_shortcut_idx"
59
+ add_index "referents", ["isbn"], :name => "index_referents_on_isbn"
60
+ add_index "referents", ["issn", "year", "volume"], :name => "by_issn"
61
+ add_index "referents", ["title"], :name => "index_referents_on_title"
62
+ add_index "referents", ["volume"], :name => "index_referents_on_volume"
63
+ add_index "referents", ["year", "volume"], :name => "by_year"
64
+
65
+ create_table "requests" do |t|
66
+ t.string "session_id", :limit => 100, :default => "", :null => false
67
+ t.integer "referent_id", :default => 0, :null => false
68
+ t.string "referrer_id"
69
+ t.datetime "created_at", :null => false
70
+ t.string "client_ip_addr"
71
+ t.boolean "client_ip_is_simulated"
72
+ t.string "contextobj_fingerprint", :limit => 32
73
+ t.string "http_env", :limit => 2048
74
+ end
75
+
76
+ add_index "requests", ["client_ip_addr"], :name => "index_requests_on_client_ip_addr"
77
+ add_index "requests", ["contextobj_fingerprint"], :name => "index_requests_on_contextobj_fingerprint"
78
+ add_index "requests", ["created_at"], :name => "req_created_at"
79
+ add_index "requests", ["referent_id", "referrer_id"], :name => "context_object_idx"
80
+ add_index "requests", ["session_id"], :name => "req_sess_idx"
81
+
82
+ create_table "service_responses" do |t|
83
+ t.string "service_id", :limit => 25, :null => false
84
+ t.string "response_key", :default => ""
85
+ t.string "value_string"
86
+ t.string "value_alt_string"
87
+ t.text "value_text"
88
+ t.string "display_text"
89
+ t.string "url", :limit => 1024
90
+ t.text "notes"
91
+ t.text "service_data"
92
+ t.datetime "created_at"
93
+ t.string "service_type_value_name"
94
+ t.integer "request_id"
95
+ end
96
+
97
+ add_index "service_responses", ["service_id", "response_key", "value_string", "value_alt_string"], :name => "svc_resp_service_id"
98
+
99
+ create_table "sfx_urls" do |t|
100
+ t.string "url"
101
+ end
102
+
103
+ add_index "sfx_urls", ["url"], :name => "index_sfx_urls_on_url"
104
+
105
+ end
106
+ end
@@ -0,0 +1,10 @@
1
+ # This migration comes from umlaut (originally 2)
2
+ class UmlautAddServiceResponseIndex < ActiveRecord::Migration
3
+ def up
4
+ add_index "service_responses", ["request_id"]
5
+ end
6
+
7
+ def down
8
+ remove_index "service_responses", ["request_id"]
9
+ end
10
+ end
@@ -0,0 +1,118 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130306173029) do
15
+
16
+ create_table "clickthroughs", :force => true do |t|
17
+ t.integer "request_id", :default => 0, :null => false
18
+ t.integer "service_response_id", :default => 0, :null => false
19
+ t.datetime "created_at", :null => false
20
+ end
21
+
22
+ add_index "clickthroughs", ["created_at"], :name => "click_created_idx"
23
+ add_index "clickthroughs", ["request_id"], :name => "click_req_id"
24
+ add_index "clickthroughs", ["service_response_id"], :name => "click_serv_resp_idx"
25
+
26
+ create_table "dispatched_services", :force => true do |t|
27
+ t.integer "request_id", :default => 0, :null => false
28
+ t.string "service_id", :default => "0", :null => false
29
+ t.datetime "updated_at", :null => false
30
+ t.text "exception_info"
31
+ t.string "status", :null => false
32
+ t.datetime "created_at"
33
+ end
34
+
35
+ add_index "dispatched_services", ["request_id", "service_id"], :name => "dptch_request_id"
36
+
37
+ create_table "permalinks", :force => true do |t|
38
+ t.integer "referent_id", :default => 0
39
+ t.date "created_on", :null => false
40
+ t.text "context_obj_serialized"
41
+ t.string "orig_rfr_id", :limit => 256
42
+ t.date "last_access"
43
+ end
44
+
45
+ add_index "permalinks", ["referent_id"], :name => "plink_referent_idx"
46
+
47
+ create_table "referent_values", :force => true do |t|
48
+ t.integer "referent_id", :default => 0, :null => false
49
+ t.string "key_name", :limit => 50, :default => "", :null => false
50
+ t.text "value"
51
+ t.string "normalized_value"
52
+ t.boolean "metadata", :default => false, :null => false
53
+ t.boolean "private_data", :default => false, :null => false
54
+ t.datetime "created_at"
55
+ end
56
+
57
+ add_index "referent_values", ["key_name", "normalized_value"], :name => "by_name_and_normal_val"
58
+ add_index "referent_values", ["referent_id", "key_name", "normalized_value"], :name => "rft_val_referent_idx"
59
+
60
+ create_table "referents", :force => true do |t|
61
+ t.string "atitle"
62
+ t.string "title"
63
+ t.string "issn", :limit => 10
64
+ t.string "isbn", :limit => 13
65
+ t.string "year", :limit => 4
66
+ t.string "volume", :limit => 10
67
+ t.datetime "created_at"
68
+ end
69
+
70
+ add_index "referents", ["atitle", "title", "issn", "isbn", "year", "volume"], :name => "rft_shortcut_idx"
71
+ add_index "referents", ["isbn"], :name => "index_referents_on_isbn"
72
+ add_index "referents", ["issn", "year", "volume"], :name => "by_issn"
73
+ add_index "referents", ["title"], :name => "index_referents_on_title"
74
+ add_index "referents", ["volume"], :name => "index_referents_on_volume"
75
+ add_index "referents", ["year", "volume"], :name => "by_year"
76
+
77
+ create_table "requests", :force => true do |t|
78
+ t.string "session_id", :limit => 100, :default => "", :null => false
79
+ t.integer "referent_id", :default => 0, :null => false
80
+ t.string "referrer_id"
81
+ t.datetime "created_at", :null => false
82
+ t.string "client_ip_addr"
83
+ t.boolean "client_ip_is_simulated"
84
+ t.string "contextobj_fingerprint", :limit => 32
85
+ t.string "http_env", :limit => 2048
86
+ end
87
+
88
+ add_index "requests", ["client_ip_addr"], :name => "index_requests_on_client_ip_addr"
89
+ add_index "requests", ["contextobj_fingerprint"], :name => "index_requests_on_contextobj_fingerprint"
90
+ add_index "requests", ["created_at"], :name => "req_created_at"
91
+ add_index "requests", ["referent_id", "referrer_id"], :name => "context_object_idx"
92
+ add_index "requests", ["session_id"], :name => "req_sess_idx"
93
+
94
+ create_table "service_responses", :force => true do |t|
95
+ t.string "service_id", :limit => 25, :null => false
96
+ t.string "response_key", :default => ""
97
+ t.string "value_string"
98
+ t.string "value_alt_string"
99
+ t.text "value_text"
100
+ t.string "display_text"
101
+ t.string "url", :limit => 1024
102
+ t.text "notes"
103
+ t.text "service_data"
104
+ t.datetime "created_at"
105
+ t.string "service_type_value_name"
106
+ t.integer "request_id"
107
+ end
108
+
109
+ add_index "service_responses", ["request_id"], :name => "index_service_responses_on_request_id"
110
+ add_index "service_responses", ["service_id", "response_key", "value_string", "value_alt_string"], :name => "svc_resp_service_id"
111
+
112
+ create_table "sfx_urls", :force => true do |t|
113
+ t.string "url"
114
+ end
115
+
116
+ add_index "sfx_urls", ["url"], :name => "index_sfx_urls_on_url"
117
+
118
+ end
@@ -0,0 +1,7 @@
1
+ # This file should contain all the record creation needed to seed the database with its default values.
2
+ # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
3
+ #
4
+ # Examples:
5
+ #
6
+ # cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
7
+ # Mayor.create(name: 'Emanuel', city: cities.first)
@@ -0,0 +1,4 @@
1
+ Connecting to database specified by database.yml
2
+ Connecting to database specified by database.yml
3
+ Connecting to database specified by database.yml
4
+ Connecting to database specified by database.yml