Module: Ohmage::API::Media

Included in:
Ohmage::API
Defined in:
lib/ohmage/media.rb

Instance Method Summary collapse

Instance Method Details

#image_read(params = {}) ⇒ Object



29
30
31
32
# File 'lib/ohmage/media.rb', line 29

def image_read(params = {})
  request = Ohmage::Request.new(self, :get, 'image/read', params)
  request.perform
end

#media_read(params = {}) ⇒ Object Also known as: audio_read, video_read

ohmage media/read call



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/ohmage/media.rb', line 9

def media_read(params = {})
  # support for media/read exists only in 2.17+
  if server_config[:application_version].to_f >= 2.17
    # 2.17 beta does not currently support size param for images
    # in media/read. wire in image_read.
    if params[:size]
      image_read(params)
    else
      request = Ohmage::Request.new(self, :get, 'media/read', params)
      request.perform
    end
  else
    # finaly, if server ver is <= 2.16 fall back to image/read for all
    # media calls. yes, this is weird. but it works!
    image_read(params)
  end
end