Class: Ravelin::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(faraday_response) ⇒ Response

Returns a new instance of Response.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/ravelin/response.rb', line 12

def initialize(faraday_response)
  return if faraday_response.body.nil? || faraday_response.body.empty?

  data = faraday_response.body.fetch('data', {})

  @customer_id  = data['customerId']
  @action       = data['action']
  @score        = data['score']
  @score_id     = data['scoreId']
  @source       = data['source']
  @comment      = data['comment']
  @customer_id  = data['customerId']
  @http_status  = faraday_response.status
  @http_body    = faraday_response.body
end

Instance Attribute Details

#actionObject (readonly)

Returns the value of attribute action.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def action
  @action
end

#commentObject (readonly)

Returns the value of attribute comment.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def comment
  @comment
end

#customer_idObject (readonly)

Returns the value of attribute customer_id.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def customer_id
  @customer_id
end

#http_bodyObject (readonly)

Returns the value of attribute http_body.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def http_body
  @http_body
end

#http_statusObject (readonly)

Returns the value of attribute http_status.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def http_status
  @http_status
end

#scoreObject (readonly)

Returns the value of attribute score.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def score
  @score
end

#score_idObject (readonly)

Returns the value of attribute score_id.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def score_id
  @score_id
end

#sourceObject (readonly)

Returns the value of attribute source.



3
4
5
# File 'lib/ravelin/response.rb', line 3

def source
  @source
end