|
58 | 58 | # repository_url 'http://localhost/provider'
|
59 | 59 | # record_prefix 'oai:localhost'
|
60 | 60 | # admin_email 'root@localhost'
|
61 |
| -# sample_identifier 'oai:pubmedcentral.gov:13900' |
| 61 | +# # record_prefix will be automatically prepended to sample_id, so in this |
| 62 | +# # case it becomes: oai:localhost:13900 |
| 63 | +# sample_id '13900' |
62 | 64 | # source_model MyModel.new
|
63 | 65 | # end
|
64 | 66 | # ```
|
|
107 | 109 | # record_prefix 'oai:blog'
|
108 | 110 | # admin_email 'root@localhost'
|
109 | 111 | # source_model OAI::Provider::ActiveRecordWrapper.new(Post)
|
110 |
| -# sample_identifier 'oai:pubmedcentral.gov:13900' |
| 112 | +# sample_id '13900' # record prefix used, so becomes oai:blog:13900 |
111 | 113 | # end
|
112 | 114 | # ```
|
113 | 115 | #
|
|
116 | 118 | # ```ruby
|
117 | 119 | # class OaiController < ApplicationController
|
118 | 120 | # def index
|
119 |
| -# # Remove controller and action from the options. Rails adds them automatically. |
120 |
| -# options = params.delete_if { |k,v| %w{controller action}.include?(k) } |
121 | 121 | # provider = BlogProvider.new
|
122 |
| -# response = provider.process_request(options) |
123 |
| -# render :text => response, :content_type => 'text/xml' |
| 122 | +# response = provider.process_request(oai_params.to_h) |
| 123 | +# render :body => response, :content_type => 'text/xml' |
| 124 | +# end |
| 125 | +# |
| 126 | +# private |
| 127 | +# |
| 128 | +# def oai_params |
| 129 | +# params.permit(:verb, :identifier, :metadataPrefix, :set, :from, :until, :resumptionToken) |
124 | 130 | # end
|
125 | 131 | # end
|
126 | 132 | # ```
|
127 | 133 | #
|
| 134 | +# And route to it in your `config/routes.rb` file: |
| 135 | +# |
| 136 | +# ```ruby |
| 137 | +# match 'oai', to: "oai#index", via: [:get, :post] |
| 138 | +# ``` |
| 139 | +# |
128 | 140 | # Special thanks to Jose Hales-Garcia for this solution.
|
129 | 141 | #
|
130 | 142 | # ## Supporting custom metadata formats
|
|
0 commit comments