Class: Octobat::FileLink

Inherits:
APIResource show all
Extended by:
APIOperations::List
Includes:
APIOperations::Create
Defined in:
lib/octobat/file_link.rb

Instance Attribute Summary

Attributes inherited from OctobatObject

#api_key, #parent_obj

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::List

list, set_parent_resource

Methods included from APIOperations::Create

included

Methods inherited from APIResource

class_name, retrieve, url, #url

Methods inherited from OctobatObject

#[], #[]=, #_dump, _load, #as_json, construct_from, #each, #initialize, #inspect, #keys, #refresh_from, #respond_to?, #to_hash, #to_json, #to_s, #values

Constructor Details

This class inherits a constructor from Octobat::OctobatObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Octobat::OctobatObject

Class Method Details

.create(params = {}, opts = {}) ⇒ Object



6
7
8
9
10
# File 'lib/octobat/file_link.rb', line 6

def self.create(params = {}, opts = {})
  api_key, headers = Util.parse_opts(opts)
  response, api_key = Octobat.request(:post, self.url, api_key, params, headers, Octobat.uploads_base)
  Util.convert_to_octobat_object(response, api_key)
end

.list(filters = {}, opts = {}) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/octobat/file_link.rb', line 17

def self.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, Octobat.uploads_base)
  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

Instance Method Details

#refreshObject



12
13
14
15
# File 'lib/octobat/file_link.rb', line 12

def refresh
  response, api_key = Octobat.request(:get, url, @api_key, @retrieve_options, @headers, Octobat.uploads_base)
  refresh_from(response, api_key)
end