Class: Nextcloud::Ruby::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/nextcloud/ruby/response.rb

Constant Summary collapse

SUCCESS_CODES =
[201, 204, 207].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, status_code) ⇒ Response

Returns a new instance of Response.



7
8
9
10
# File 'lib/nextcloud/ruby/response.rb', line 7

def initialize(body, status_code)
  @body = to_xml(body)
  @status_code = status_code
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



5
6
7
# File 'lib/nextcloud/ruby/response.rb', line 5

def body
  @body
end

#status_codeObject

Returns the value of attribute status_code.



5
6
7
# File 'lib/nextcloud/ruby/response.rb', line 5

def status_code
  @status_code
end

Instance Method Details

#ok?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/nextcloud/ruby/response.rb', line 12

def ok?
  SUCCESS_CODES.include?(@status_code)
end