Class: Moxprox::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/moxprox/request.rb

Instance Method Summary collapse

Constructor Details

#initialize(path, method = "post", query = {}) ⇒ Request

Returns a new instance of Request.



3
4
5
6
7
# File 'lib/moxprox/request.rb', line 3

def initialize(path, method = "post", query = {})
  @path = path
  @query = query
  @method = method
end

Instance Method Details

#perform(ticket) ⇒ Object



9
10
11
12
13
# File 'lib/moxprox/request.rb', line 9

def perform(ticket)
  result = ticket.connection.request(path: "/api2/json/#{@path}", method: @method, query: @query, headers: ticket.headers)
  data = JSON.parse(result.body)
  data["data"]
end