Class: HTTPHelper

Inherits:
Object
  • Object
show all
Defined in:
lib/committer-tools.rb

Class Method Summary collapse

Class Method Details

.get(url) ⇒ Object



5
6
7
# File 'lib/committer-tools.rb', line 5

def self.get(url)
  RestClient.get(url, { params: { access_token: @@token } }).body
end

.get_json(url) ⇒ Object



9
10
11
# File 'lib/committer-tools.rb', line 9

def self.get_json(url)
  JSON.parse(get(url))
end

.with_auth(token) {|block| ... } ⇒ Object

Yields:

  • (block)


13
14
15
16
17
# File 'lib/committer-tools.rb', line 13

def self.with_auth(token, &block)
  @@token = token
  yield block
  @@token = nil
end