Skip to content
This repository has been archived by the owner on Mar 24, 2020. It is now read-only.

Fixes - #270 Implemented mapping from DAMS4 to SHARE V2 API and updated push function. #451

Closed
wants to merge 9 commits into from

Conversation

hweng
Copy link
Contributor

@hweng hweng commented May 15, 2018

Fixes #270 ; refs #270

osf_data = { funding: other_note['value'] } if other_note['type'] == 'funding'
end
end
osf_data

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.

other_note = JSON.parse(datum)
osf_data = { funding: other_note['value'] } if other_note['type'] == 'funding'
end
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/EndAlignment: end at 108, 4 is not aligned with if at 103, 3.

osf_data = {}

if dams_data != nil
dams_data.each do |datum|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationWidth: Use 2 (not 3) spaces for indentation.

dams_data = document["#{field_name}"]
osf_data = {}

if dams_data != nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.
Style/NonNilCheck: Prefer !expression.nil? over expression != nil.

def osf_extra(document)
field_name = 'otherNote_json_tesim'
dams_data = document["#{field_name}"]
osf_data = {}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.

"creator",
"funder",
"host",
"principalinvestigator",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignArray: Align the elements of an array literal if they span more than one line.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"contributor",
"creator",
"funder",
"host",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignArray: Align the elements of an array literal if they span more than one line.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"agentworkrelation",
"contributor",
"creator",
"funder",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignArray: Align the elements of an array literal if they span more than one line.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"Publisher",
"agentworkrelation",
"contributor",
"creator",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignArray: Align the elements of an array literal if they span more than one line.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

"PrincipalInvestigatorContact",
"Publisher",
"agentworkrelation",
"contributor",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/AlignArray: Align the elements of an array literal if they span more than one line.
Style/StringLiterals: Prefer single-quoted strings when you don't need string interpolation or special symbols.

dams_data.each do |datum|
other_note = JSON.parse(datum)
osf_data = { funding: other_note['value'] } if other_note['type'] == 'funding'
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/BlockAlignment: end at 107, 6 is not aligned with dams_data.each do |datum| at 104, 8.

osf_data = {}

if !dams_data.nil
dams_data.each do |datum|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationWidth: Use 2 (not 5) spaces for indentation.

dams_data = document["#{field_name}"]
osf_data = {}

if !dams_data.nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/IndentationConsistency: Inconsistent indentation detected.
Style/NegatedIf: Favor unless over if for negative conditions.

classname = self.class.name.gsub("sController","")
def get_data(recursive = true, format)
format = format.presence || 'xml'
viewerUrl = "#{dams_api_path}/api/objects/#{params[:id]}?" + (recursive ? 'recursive=true&' : '') + "format=#{format}"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/VariableName: Use snake_case for variable names.

end

def audit( id = "unknown" )
classname = self.class.name.gsub("sController","")
def get_data(recursive = true, format)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/OptionalArguments: Optional arguments should appear at the end of the argument list.

def get_html_data(params, controller_path)
xsl = params[:xsl].presence || 'review.xsl'
controller = controller_path.blank? ? '' : '&controller=' + URI.encode(controller_path)
viewerUrl = "#{dams_api_path}/api/objects/#{params[:id]}/transform?recursive=true&xsl=#{xsl}&baseurl=" + URI.encode(dams_api_path) + controller

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/VariableName: Use snake_case for variable names.
Lint/UriEscapeUnescape: URI.encode method is obsolete and should not be used. Instead, use CGI.escape, URI.encode_www_form or URI.encode_www_form_component depending on your specific use case.

res.body
def get_html_data(params, controller_path)
xsl = params[:xsl].presence || 'review.xsl'
controller = controller_path.blank? ? '' : '&controller=' + URI.encode(controller_path)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UriEscapeUnescape: URI.encode method is obsolete and should not be used. Instead, use CGI.escape, URI.encode_www_form or URI.encode_www_form_component depending on your specific use case.

else
return { alert: json['message'] }
end
rescue Exception => e

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/RescueException: Avoid rescuing the Exception class. Perhaps you meant to rescue StandardError?

ext = File.extname(file.original_filename)
@ds += ext unless ext.nil?

# check mime type and include derivatives hook if derivable
mt = file.content_type
if ext.include?("wav") || ext.include?("tif") || ext.include?("mov") || ext.include?("avi") || ext.include?("pdf")
if ext.include?('wav') || ext.include?('tif') || ext.include?('mov') || ext.include?('avi') || ext.include?('pdf')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/GuardClause: Use a guard clause instead of wrapping the code inside a conditional expression.

roleId = ''
unless relationship.nil?
relationship.each do |relation|
roleId = relation.role.first.pid unless relation.role.nil?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/VariableName: Use snake_case for variable names.

relationship = object.relationship
roleId = ''
unless relationship.nil?
relationship.each do |relation|

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/BlockLength: Block has too many lines. [36/25]

def get_relationships(object)
relationshipArray = []
relationship = object.relationship
roleId = ''

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/VariableName: Use snake_case for variable names.

end

def get_relationships(object)
relationshipArray = []

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Naming/VariableName: Use snake_case for variable names.

@coveralls
Copy link

coveralls commented May 15, 2018

Coverage Status

Coverage decreased (-0.2%) to 66.006% when pulling 93faf66 on feature/SHARE_V2_updates into 683aea5 on develop.

@hweng hweng force-pushed the feature/SHARE_V2_updates branch from 93faf66 to 3b42cb5 Compare May 15, 2018 20:02
'tags': osf_mads_fields(document),
'publisher': osf_publisher
'extra': osf_extra(document)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

'languages': osf_languages(document),
'providerUpdatedDateTime': osf_date(document),
'date_published': osf_date_published(document),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

def export_to_API(document)
field_map = {
'title': osf_title(document),
'description': osf_description(document),
'contributor': osf_contributors(document),
'uris': osf_uris(document),
'related_agents': osf_related_agents(document),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

@@ -70,7 +135,7 @@ def osf_uris(document)
osf_data
end

def osf_date(document)
def osf_date_published(document)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

end
end
osf_data
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

if !dams_data.nil
dams_data.each do |datum|
other_note = JSON.parse(datum)
osf_data = { funding: other_note['value'] } if other_note['type'] == 'funding'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.


if !dams_data.nil
dams_data.each do |datum|
other_note = JSON.parse(datum)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

dams_data = document["#{field_name}"]
osf_data = {}

if !dams_data.nil

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.
Layout/IndentationConsistency: Inconsistent indentation detected.
Style/NegatedIf: Favor unless over if for negative conditions.

type = (share_agent_type.include? type) ? type : 'Contributor'
end

def osf_extra(document)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

'publisher'
]
type = (share_agent_type.include? type) ? type : 'Contributor'
end

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/Tab: Tab detected.

@hweng hweng closed this May 17, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants