Class: Xio::Resource

Inherits:
Object
  • Object
show all
Includes:
Serializer
Defined in:
lib/xio/resource.rb

Direct Known Subclasses

Stream

Class Method Summary collapse

Methods included from Serializer

#decode, #encode, included

Class Method Details

.api_key_idObject



6
7
8
# File 'lib/xio/resource.rb', line 6

def self.api_key_id
  Xio.api_key_id
end

.api_secret_keyObject



10
11
12
# File 'lib/xio/resource.rb', line 10

def self.api_secret_key
  Xio.api_secret_key
end

.base_urlObject



14
15
16
# File 'lib/xio/resource.rb', line 14

def self.base_url
  Xio.base_url
end

.delete(path, options = {}) ⇒ Object



41
42
43
44
45
46
# File 'lib/xio/resource.rb', line 41

def self.delete(path, options={})
  options = options.dup
  url     = url_for(path)
  options = add_api_key_header(options)
  HTTP.delete(url, options)
end

.get(path, options = {}) ⇒ Object



34
35
36
37
38
39
# File 'lib/xio/resource.rb', line 34

def self.get(path, options={})
  options = options.dup
  url     = url_for(path, options)
  options = add_api_key_header(options)
  HTTP.get(url, options)
end

.post(path, params = {}, options = {}) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/xio/resource.rb', line 18

def self.post(path, params={}, options={})
  options = options.dup
  url     = url_for(path, options)
  body    = encode(params)
  options = add_api_key_header(options)
  HTTP.post(url, body, options)
end

.put(path, params = {}, options = {}) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/xio/resource.rb', line 26

def self.put(path, params={}, options={})
  options = options.dup
  url     = url_for(path, options)
  body    = encode(params)
  options = add_api_key_header(options)
  HTTP.put(url, body, options)
end