Module: Validic::REST::Weight
- Included in:
- Client
- Defined in:
- lib/validic/rest/weight.rb
Instance Method Summary collapse
- #create_weight(options = {}) ⇒ Object
- #delete_weight(options = {}) ⇒ Object
- #get_weight(params = {}) ⇒ Object (also: #get_weights)
- #latest_weight(options = {}) ⇒ Object
- #update_weight(options = {}) ⇒ Object
Instance Method Details
#create_weight(options = {}) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/validic/rest/weight.rb', line 12 def create_weight(={}) user_id = .delete(:user_id) = { user_id: user_id, weight: } resp = post_request(:weight, ) Validic::Weight.new(resp['weight']) end |
#delete_weight(options = {}) ⇒ Object
27 28 29 30 31 32 |
# File 'lib/validic/rest/weight.rb', line 27 def delete_weight( = {}) user_id, _id = .delete(:user_id), .delete(:_id) = { user_id: user_id, _id: _id } delete_request(:weight, ) true end |
#get_weight(params = {}) ⇒ Object Also known as: get_weights
7 8 9 |
# File 'lib/validic/rest/weight.rb', line 7 def get_weight(params={}) build_response(get_request(:weight, params)) end |
#latest_weight(options = {}) ⇒ Object
34 35 36 |
# File 'lib/validic/rest/weight.rb', line 34 def latest_weight(={}) build_response(latest(:weight, )) end |
#update_weight(options = {}) ⇒ Object
20 21 22 23 24 25 |
# File 'lib/validic/rest/weight.rb', line 20 def update_weight(={}) user_id, _id = .delete(:user_id), .delete(:_id) = { user_id: user_id, _id: _id, weight: } response = put_request(:weight, ) Validic::Weight.new(response["weight"]) end |