lib/sportradar/api/content/article.rb in sportradar-api-0.1.38 vs lib/sportradar/api/content/article.rb in sportradar-api-0.9.0
- old
+ new
@@ -14,29 +14,18 @@
@byline = data["byline"]
@dateline = data["dateline"]
@credit = data["credit"]
@content = data["content"]["long"] if data["content"] && data["content"]["long"]
@provider = OpenStruct.new(data["provider"]) if data["provider"]
- set_references
+ @references = parse_into_array(selector: response["refs"]["ref"], klass: Sportradar::Api::Content::Reference) if response["refs"] && response["refs"]["ref"]
end
def transaction?
transaction == 'true'
end
def injury?
injury == 'true'
- end
-
- private
- def set_references
- if response["refs"] && response["refs"]["ref"]
- if response["refs"]["ref"].is_a?(Array)
- @references = response["refs"]["ref"].map {|x| Sportradar::Api::Content::Reference.new x }
- elsif response["refs"]["ref"].is_a?(Hash)
- @references = [ Sportradar::Api::Content::Reference.new(response["refs"]["ref"]) ]
- end
- end
end
end
end
end