lib/sportradar/api/images/asset.rb in sportradar-api-0.1.38 vs lib/sportradar/api/images/asset.rb in sportradar-api-0.9.0
- old
+ new
@@ -10,36 +10,12 @@
@created = data["created"]
@updated = data["updated"]
@title = data["title"]
@description = data["description"]
@copyright = data["copyright"]
-
- set_links
- set_tags
+ @links = parse_into_array(selector: response["links"]["link"], klass: Sportradar::Api::Images::Link) if response["links"] && response["links"]["link"]
+ @tags = parse_into_array(selector: response["tags"]["tag"], klass: Sportradar::Api::Images::Tag) if response["tags"] && response["tags"]["tag"]
end
-
- private
-
- def set_links
- if response["links"] && response["links"]["link"]
- if response["links"]["link"].is_a?(Array)
- @links = response["links"]["link"].map {|x| Sportradar::Api::Images::Link.new x }
- elsif response["links"]["link"].is_a?(Hash)
- @links = [ Sportradar::Api::Images::Link.new(response["links"]["link"]) ]
- end
- end
- end
-
- def set_tags
- if response["tags"] && response["tags"]["tag"]
- if response["tags"]["tag"].is_a?(Array)
- @tags = response["tags"]["tag"].map {|x| Sportradar::Api::Images::Tag.new x }
- elsif response["tags"]["tag"].is_a?(Hash)
- @tags = [ Sportradar::Api::Images::Tag.new(response["tags"]["tag"]) ]
- end
- end
- end
-
end
end
end