Module: Poms::Fields

Extended by:
Fields
Included in:
Poms, Fields
Defined in:
lib/poms/fields.rb

Overview

Gets fields from Poms results

Instance Method Summary collapse

Instance Method Details

#image_id(image) ⇒ Object

Extracts the image id from an image hash Expects a hash of just an image from POMS



18
19
20
# File 'lib/poms/fields.rb', line 18

def image_id(image)
  image['imageUri'].split(':').last
end

#images(item) ⇒ Object

Returns the images from the hash



12
13
14
# File 'lib/poms/fields.rb', line 12

def images(item)
  item['images']
end

#title(item, options = { type: 'MAIN' }) ⇒ Object

Returns the title, main by default



7
8
9
# File 'lib/poms/fields.rb', line 7

def title(item, options = { type: 'MAIN' })
  item['titles'].find { |title| title['type'] == options[:type] }['value']
end