Class: Avocado::Request

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
app/models/avocado/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeRequest

Returns a new instance of Request.



8
9
10
11
# File 'app/models/avocado/request.rb', line 8

def initialize(*)
  super
  self.uid = SecureRandom.hex
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def body
  @body
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'app/models/avocado/request.rb', line 6

def description
  @description
end

#endpointObject

Returns the value of attribute endpoint.



6
7
8
# File 'app/models/avocado/request.rb', line 6

def endpoint
  @endpoint
end

#headersObject

Returns the value of attribute headers.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def headers
  @headers
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def params
  @params
end

#pathObject

Returns the value of attribute path.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def path
  @path
end

#statusObject

Returns the value of attribute status.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def status
  @status
end

#uidObject

Returns the value of attribute uid.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def uid
  @uid
end

#urlObject

Returns the value of attribute url.



5
6
7
# File 'app/models/avocado/request.rb', line 5

def url
  @url
end

Instance Method Details

#<=>(other) ⇒ Object



20
21
22
# File 'app/models/avocado/request.rb', line 20

def <=>(other)
  status <=> other.status
end

#==(other) ⇒ Object



13
14
15
16
17
18
# File 'app/models/avocado/request.rb', line 13

def ==(other)
  other.path  == path &&
  other.params == params &&
  other.status == status &&
  other.body == body
end

#unique?(requests) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'app/models/avocado/request.rb', line 24

def unique?(requests)
  requests.none? { |req| self == req }
end