Class: FakeRest::UserRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/fakerest/userrequests.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, url, body, response_status_code, params = {}, request_file_path = "", request_file_type = "") ⇒ UserRequest

Returns a new instance of UserRequest.



6
7
8
9
10
11
12
13
14
# File 'lib/fakerest/userrequests.rb', line 6

def initialize(method, url, body, response_status_code, params = {}, request_file_path = "", request_file_type = "")
  @method = method
  @url = url
  @body = body
  @params = params
  @response_status_code = response_status_code
  @request_file_path = request_file_path
  @request_file_type = request_file_type
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/fakerest/userrequests.rb', line 5

def body
  @body
end

#methodObject (readonly)

Returns the value of attribute method.



5
6
7
# File 'lib/fakerest/userrequests.rb', line 5

def method
  @method
end

#request_file_pathObject (readonly)

Returns the value of attribute request_file_path.



5
6
7
# File 'lib/fakerest/userrequests.rb', line 5

def request_file_path
  @request_file_path
end

#request_file_typeObject (readonly)

Returns the value of attribute request_file_type.



5
6
7
# File 'lib/fakerest/userrequests.rb', line 5

def request_file_type
  @request_file_type
end

#response_status_codeObject (readonly)

Returns the value of attribute response_status_code.



5
6
7
# File 'lib/fakerest/userrequests.rb', line 5

def response_status_code
  @response_status_code
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/fakerest/userrequests.rb', line 5

def url
  @url
end

Instance Method Details

#to_json(*ur) ⇒ Object



16
17
18
19
20
21
22
23
# File 'lib/fakerest/userrequests.rb', line 16

def to_json(*ur)      
  {
      "method" => @method,
      "url" => @url,
      "body" => @body,
      "params" => @params.reject {|key,value| key == 'file' or key == 'splat' or key == 'captures' or key == 'outvar' or key =='default_encoding'  }
  }.to_json(*ur)
end