Class: TochkaCyclopsApi::Result

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

Overview

Displays the result of request

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



6
7
8
# File 'lib/tochka_cyclops_api/result.rb', line 6

def data
  @data
end

#error_messageObject (readonly)

Returns the value of attribute error_message.



6
7
8
# File 'lib/tochka_cyclops_api/result.rb', line 6

def error_message
  @error_message
end

#successObject (readonly)

Returns the value of attribute success.



6
7
8
# File 'lib/tochka_cyclops_api/result.rb', line 6

def success
  @success
end

Class Method Details

.create(success, data = nil, error_message = nil) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/tochka_cyclops_api/result.rb', line 8

def self.create(success, data = nil, error_message = nil)
  @success = success
  @data = data
  @error_message = error_message

  display_result
end

.failure(error_message) ⇒ Object



20
21
22
# File 'lib/tochka_cyclops_api/result.rb', line 20

def self.failure(error_message)
  Result.create(false, nil, error_message)
end

.success(data) ⇒ Object



16
17
18
# File 'lib/tochka_cyclops_api/result.rb', line 16

def self.success(data)
  Result.create(true, data)
end