Skip to content

Commit

Permalink
show events in test system
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 17, 2019
1 parent 29205bc commit 5bec197
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/models/event.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Event
def self.find_by_id(id)
return { errors: [{ "title" => "No id provided"} ] } unless id.present?

url = "https://api.datacite.org/events/#{id}"
url = Rails.env.production? ? "https://api.datacite.org/events/#{id}" : "https://api.test.datacite.org/events/#{id}"
response = Maremma.get(url, accept: "application/vnd.api+json; version=2")

if response.status == 200
Expand All @@ -23,8 +23,8 @@ def self.find_by_id(id)
def self.query(query, options={})
size = options[:limit] || 100
doi = options[:doi].present? ? doi_from_url(options[:doi]) : nil

url = "https://api.datacite.org/events?page[size]=#{size}"
url = Rails.env.production? ? "https://api.datacite.org/events?page[size]=#{size}" : "https://api.test.datacite.org/events?page[size]=#{size}"
url += "&relation-type-id=#{options[:relation_type_id]}" if options[:relation_type_id].present?
url += "&source-id=#{options[:source_id]}" if options[:source_id].present?
url += "&citation-type=#{options[:citation_type]}" if options[:citation_type].present?
Expand Down

0 comments on commit 5bec197

Please sign in to comment.