Class: CdekClient::Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response, data, errors = []) ⇒ Result

Returns a new instance of Result.



7
8
9
10
11
# File 'lib/cdek_client/result.rb', line 7

def initialize(response, data, errors = [])
  @response = response
  @data = data
  @errors = errors
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/cdek_client/result.rb', line 5

def data
  @data
end

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/cdek_client/result.rb', line 5

def errors
  @errors
end

#responseObject (readonly)

Returns the value of attribute response.



5
6
7
# File 'lib/cdek_client/result.rb', line 5

def response
  @response
end

Instance Method Details

#add_error(error) ⇒ Object



17
18
19
# File 'lib/cdek_client/result.rb', line 17

def add_error(error)
  errors.push error
end

#set_data(data) ⇒ Object



13
14
15
# File 'lib/cdek_client/result.rb', line 13

def set_data(data)
  @data = data
end