Skip to content

Commit

Permalink
support usage reports from test system. #260
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed May 16, 2019
1 parent d5d29ce commit 29205bc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions app/models/usage_report.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ class UsageReport
include Modelable

def self.find_by_id(id)
url = "https://api.datacite.org/reports/#{id}"
url = Rails.env.production? ? "https://api.datacite.org/reports/#{id}" : "https://api.test.datacite.org/reports/#{id}"

response = Maremma.get(url)

return {} if response.status != 200
Expand All @@ -22,8 +23,8 @@ def self.query(query, options={})
number = (options.dig(:page, :number) || 1).to_i
size = (options.dig(:page, :size) || 25).to_i

url = "https://api.datacite.org/reports?page[size]=#{size}&page[number]=#{number}"

url = Rails.env.production? ? "https://api.datacite.org/reports?page[size]=#{size}&page[number]=#{number}" : "https://api.test.datacite.org/reports?page[size]=#{size}&page[number]=#{number}"
response = Maremma.get(url)

return {} if response.status != 200
Expand Down

0 comments on commit 29205bc

Please sign in to comment.