lib/sportradar/api/soccer/standing.rb in sportradar-api-0.1.38 vs lib/sportradar/api/soccer/standing.rb in sportradar-api-0.9.0
- old
+ new
@@ -3,22 +3,11 @@
class Soccer::Standing < Data
attr_accessor :response, :categories
def initialize(data)
@response = data
- set_categories
+ @categories = parse_into_array(selector: response["categories"]["category"], klass: Sportradar::Api::Soccer::Category) if response["categories"] && response["categories"]["category"]
end
- private
-
- def set_categories
- if response["categories"] && response["categories"]["category"]
- if response["categories"]["category"].is_a?(Array)
- @categories = response["categories"]["category"].map {|x| Sportradar::Api::Soccer::Category.new x }
- elsif response["categories"]["category"].is_a?(Hash)
- @categories = [ Sportradar::Api::Soccer::Category.new(response["categories"]["category"]) ]
- end
- end
- end
end
end
end