module Validic::REST::Weight

Public Instance Methods

create_weight(options={}) click to toggle source
# File lib/validic/rest/weight.rb, line 12
def create_weight(options={})
  user_id = options.delete(:user_id)
  options = { user_id: user_id, weight: options }
  resp = post_request(:weight, options)

  Validic::Weight.new(resp['weight'])
end
delete_weight(options = {}) click to toggle source
# File lib/validic/rest/weight.rb, line 27
def delete_weight(options = {})
  user_id, _id = options.delete(:user_id), options.delete(:_id)
  options = { user_id: user_id, _id: _id }
  delete_request(:weight, options)
  true
end
get_weight(params={}) click to toggle source
# File lib/validic/rest/weight.rb, line 7
def get_weight(params={})
  build_response(get_request(:weight, params))
end
Also aliased as: get_weights
get_weights(params={})
Alias for: get_weight
latest_weight(options={}) click to toggle source
# File lib/validic/rest/weight.rb, line 34
def latest_weight(options={})
  build_response(latest(:weight, options))
end
update_weight(options={}) click to toggle source
# File lib/validic/rest/weight.rb, line 20
def update_weight(options={})
  user_id, _id = options.delete(:user_id), options.delete(:_id)
  options = { user_id: user_id, _id: _id, weight: options }
  response = put_request(:weight, options)
  Validic::Weight.new(response["weight"])
end