Class: CognitiveVision::ImageFeature::Category

Inherits:
Object
  • Object
show all
Defined in:
lib/cognitive_vision/image_feature/category.rb

Instance Method Summary collapse

Instance Method Details

#keyObject



4
5
6
# File 'lib/cognitive_vision/image_feature/category.rb', line 4

def key
  'categories'
end

#parse(response) ⇒ Object



8
9
10
11
# File 'lib/cognitive_vision/image_feature/category.rb', line 8

def parse(response)
  return [] unless response[key].is_a?(Array)
  response[key].map { |category| CognitiveVision::Category.new(name: category['name'], score: category['score']) }
end