Class: Vidsy::Data::API::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/vidsy/data/api/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.get(path) ⇒ Object



10
11
12
# File 'lib/vidsy/data/api/request.rb', line 10

def self.get(path)
  new.get path
end

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



14
15
16
# File 'lib/vidsy/data/api/request.rb', line 14

def self.post(path, options = {})
  new.post(path, options)
end

Instance Method Details

#get(path) ⇒ Object



18
19
20
21
22
23
# File 'lib/vidsy/data/api/request.rb', line 18

def get(path)
  connection.get do |r|
    r.url complete_path(path)
    r.options.timeout = TIMEOUT
  end
end

#post(path, options) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/vidsy/data/api/request.rb', line 25

def post(path, options)
  connection.post do |r|
    r.body = options.to_json
    r.headers["Content-Type"] = "application/json"
    r.url complete_path(path)
    r.options.timeout = TIMEOUT
  end
end