Class: Moxprox::Request
- Inherits:
-
Object
- Object
- Moxprox::Request
- Defined in:
- lib/moxprox/request.rb
Instance Method Summary collapse
-
#initialize(path, method = "post", query = {}) ⇒ Request
constructor
A new instance of Request.
- #perform(ticket) ⇒ Object
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 |