Sha256: a5efdfee7afbba13acfb08b6545f9a7a57880075e083f3daa4073aac5785ec82

Contents?: true

Size: 516 Bytes

Versions: 5

Compression:

Stored size: 516 Bytes

Contents

# frozen_string_literal: true

module MyTankInfo
  class TanksResource < Resource
    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

    def retrieve(tank_id:)
      Tank.new get_request("api/tanks/#{tank_id}").body
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
my_tank_info-1.1.1 lib/my_tank_info/resources/tanks.rb
my_tank_info-1.1.0 lib/my_tank_info/resources/tanks.rb
my_tank_info-1.0.2 lib/my_tank_info/resources/tanks.rb
my_tank_info-1.0.1 lib/my_tank_info/resources/tanks.rb
my_tank_info-1.0.0 lib/my_tank_info/resources/tanks.rb