Class: Stardog::StardogResponse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, body) ⇒ StardogResponse

Returns a new instance of StardogResponse.



41
42
43
44
# File 'lib/stardog.rb', line 41

def initialize(status, body)
  @status = status
  @body = body
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



39
40
41
# File 'lib/stardog.rb', line 39

def body
  @body
end

#statusObject (readonly)

Returns the value of attribute status.



39
40
41
# File 'lib/stardog.rb', line 39

def status
  @status
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/stardog.rb', line 46

def success?
  @status.to_s =~ /^2\d{2}$/
end

#to_sObject



50
51
52
# File 'lib/stardog.rb', line 50

def to_s
  "#{status}\n--------\n#{body}\n--------\n"
end