Class: KintoBox::KintoRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/kinto_box/kinto_request.rb

Direct Known Subclasses

KintoBatchRequest

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, method, path, body = {}, headers: nil) ⇒ KintoRequest

Returns a new instance of KintoRequest.



5
6
7
8
9
10
11
# File 'lib/kinto_box/kinto_request.rb', line 5

def initialize(client, method, path, body = {}, headers: nil)
  @client = client
  @method = method
  @path = path
  @body = body
  @headers = headers
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



3
4
5
# File 'lib/kinto_box/kinto_request.rb', line 3

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



3
4
5
# File 'lib/kinto_box/kinto_request.rb', line 3

def headers
  @headers
end

#methodObject (readonly)

Returns the value of attribute method.



3
4
5
# File 'lib/kinto_box/kinto_request.rb', line 3

def method
  @method
end

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/kinto_box/kinto_request.rb', line 3

def path
  @path
end

Instance Method Details

#executeObject



17
18
19
# File 'lib/kinto_box/kinto_request.rb', line 17

def execute
  @client.send_request(self)
end

#to_hashObject



13
14
15
# File 'lib/kinto_box/kinto_request.rb', line 13

def to_hash
  { 'method' => method, 'path' => path, 'body' => body }
end