Class: PortaText::Command::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/portatext/command/result.rb

Overview

This class holds the result of calling the endpoint.

Author

Marcelo Gornstein ([email protected])

Copyright

Copyright © 2015 PortaText

License

Apache-2.0

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, headers, data) ⇒ Result

Returns a new instance of Result.



14
15
16
17
18
19
# File 'lib/portatext/command/result.rb', line 14

def initialize(code, headers, data)
  @code = code
  @headers = headers
  @data = data
  @success = code > 199 && code < 300
end

Instance Attribute Details

#codeObject

Returns the value of attribute code.



9
10
11
# File 'lib/portatext/command/result.rb', line 9

def code
  @code
end

#dataObject

Returns the value of attribute data.



11
12
13
# File 'lib/portatext/command/result.rb', line 11

def data
  @data
end

#headersObject

Returns the value of attribute headers.



10
11
12
# File 'lib/portatext/command/result.rb', line 10

def headers
  @headers
end

#successObject (readonly)

Returns the value of attribute success.



12
13
14
# File 'lib/portatext/command/result.rb', line 12

def success
  @success
end