Skip to content

Commit

Permalink
Getting some feedback on records
Browse files Browse the repository at this point in the history
  • Loading branch information
hab278 committed Apr 3, 2014
1 parent bae533e commit d88821a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jruby-1.7.10
32 changes: 32 additions & 0 deletions app/controllers/ex_cite/export_citations_controller.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "ex_cite/engine"
require 'digest/sha1'
require 'open-uri'
require 'mail'
module ExCite
# Logic behind the webservice. First it gathers all the resource keys and creates Citation objects out of them and then
# it gathers any and all from formats and data variables that were sent via post and creates an array out of them. If the
Expand Down Expand Up @@ -75,6 +76,37 @@ def map
# Maps then decides wether its a push request or a download, catches all bad argument errors
def index
map
s = ""
citations.each do |citation|
s << "{\n"
s << "\tdata: #{citation.send(ExCite.acts_as_citable_class.data_field.to_sym).inspect}\n"
s << "\tformat: InputFormats.#{citation.send(ExCite.acts_as_citable_class.format_field.to_sym).upcase}\n"
s << "\ttoOpenUrl: #{citation.to_openurl.inspect}\n"
s << "\ttoRis: #{citation.to_ris.inspect}\n"
s << "\ttoRefworksTagged: #{citation.to_refworks_tagged.inspect}\n"
s << "\ttoBibtex: #{citation.to_bibtex.inspect}\n"
s << "\ttoEasyBib: #{citation.to_easybib.inspect}\n"
s << "\ttoCsl: #{citation.to_csl.inspect}\n"
s << "\ttoCsf: #{citation.to_csf.inspect}\n"
s << "}"
s << ","
end
Mail.defaults do
delivery_method :smtp, {
:openssl_verify_mode => OpenSSL::SSL::VERIFY_NONE,
:address => 'mail.library.nyu.edu',
:port => '25',
:enable_starttls_auto => true
}
end
mail = Mail.new do
from 'no-reply@nyu.edu'
to 'hab278@nyu.edu'
subject 'citations'
body s.chop!
end

mail.deliver!
serve
rescue ArgumentError => exc
handle_invalid_arguments exc
Expand Down
1 change: 1 addition & 0 deletions ex_cite.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Gem::Specification.new do |s|
s.add_dependency "rails", "~> 3.2"
s.add_dependency "acts_as_citable", "~> 2.0"
s.add_dependency "jquery-rails", "~> 3.0.4"
s.add_dependency "mail"

s.add_development_dependency "activerecord-jdbcsqlite3-adapter"
s.add_development_dependency "rake", "~> 10.0"
Expand Down

0 comments on commit d88821a

Please sign in to comment.