Module: Instagram::Request

Defined in:
lib/instagram/request.rb

Overview

Defines HTTP request methods

Instance Method Summary collapse

Instance Method Details

#delete(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = no_response_wrapper(), signed = sign_requests) ⇒ Object

Perform an HTTP DELETE request



37
38
39
# File 'lib/instagram/request.rb', line 37

def delete(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper(), signed=sign_requests)
  request(:delete, path, options, signature, raw, unformatted, no_response_wrapper, signed)
end

#get(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = no_response_wrapper(), signed = sign_requests) ⇒ Object

Perform an HTTP GET request



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/instagram/request.rb', line 8

def get(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper(), signed=sign_requests)
  ret = nil
  ntry = 0
  max_try = 5
  begin
    ntry += 1
    sleep 1 if ntry > 1
    ret = request(:get, path, options, signature, raw, unformatted, no_response_wrapper, signed)
  rescue Zlib::BufError => e
    retry if ntry < max_try
    raise e
  rescue Faraday::ConnectionFailed => e
    retry if ntry < max_try
    raise e
  end
  ret
end

#post(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = no_response_wrapper(), signed = sign_requests) ⇒ Object

Perform an HTTP POST request



27
28
29
# File 'lib/instagram/request.rb', line 27

def post(path, options={}, signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper(), signed=sign_requests)
  request(:post, path, options, signature, raw, unformatted, no_response_wrapper, signed)
end

#put(path, options = {}, signature = false, raw = false, unformatted = false, no_response_wrapper = no_response_wrapper(), signed = sign_requests) ⇒ Object

Perform an HTTP PUT request



32
33
34
# File 'lib/instagram/request.rb', line 32

def put(path, options={},  signature=false, raw=false, unformatted=false, no_response_wrapper=no_response_wrapper(), signed=sign_requests)
  request(:put, path, options, signature, raw, unformatted, no_response_wrapper, signed)
end