module Octobat::APIOperations::List

Public Instance Methods

all(filters={}, opts={})
Alias for: list
list(filters={}, opts={}) click to toggle source
# File lib/octobat/api_operations/list.rb, line 4
def list(filters={}, opts={})
  set_parent_resource(filters)
  api_key, headers = Util.parse_opts(opts)
  
  api_key ||= @api_key

  f = filters.select{|request_filter| !@parent_resource.has_key?(request_filter)}

  response, api_key = Octobat.request(:get, url, api_key, f, headers)
  obj = ListObject.construct_from(response, api_key)

  obj.filters = filters.dup
  obj.cursors[:ending_before] = obj.filters.delete(:ending_before)
  obj.cursors[:starting_after] = obj.filters.delete(:starting_after)

  obj.filters.delete(:expand)
  obj.parent_resource = @parent_resource

  obj
end
Also aliased as: all
set_parent_resource(filters) click to toggle source
# File lib/octobat/api_operations/list.rb, line 25
def set_parent_resource(filters)
  @parent_resource = {}
end