class MyTankInfo::TanksResource

Public Instance Methods

list(site_id: nil) click to toggle source
# File lib/my_tank_info/resources/tanks.rb, line 5
def list(site_id: nil)
  response = get_request("api/tanks")

  if site_id.nil?
    Collection.from_response(response, type: Tank)
  else
    Collection.from_response(
      response,
      type: Tank,
      filter_attribute: :site_id,
      filter_value: site_id
    )
  end
end
retrieve(tank_id:) click to toggle source
# File lib/my_tank_info/resources/tanks.rb, line 20
def retrieve(tank_id:)
  Tank.new get_request("api/tanks/#{tank_id}").body
end