Class: Ucb::Hcm::Response

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ucb/hcm/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ Response

Returns a new instance of Response.



10
11
12
# File 'lib/ucb/hcm/response.rb', line 10

def initialize(raw_response)
  @raw_response = raw_response
end

Instance Attribute Details

#data_fetcherObject

Returns the value of attribute data_fetcher.



6
7
8
# File 'lib/ucb/hcm/response.rb', line 6

def data_fetcher
  @data_fetcher
end

#raw_responseObject (readonly)

Returns the value of attribute raw_response.



6
7
8
# File 'lib/ucb/hcm/response.rb', line 6

def raw_response
  @raw_response
end

Instance Method Details

#dataObject



22
23
24
25
26
27
28
# File 'lib/ucb/hcm/response.rb', line 22

def data
  if raw_response["response"]&.count == 1
    raw_response["response"]&.first
  else
    raw_response["response"]
  end
end

#responseObject



14
15
16
# File 'lib/ucb/hcm/response.rb', line 14

def response
  raw_response
end

#success?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/ucb/hcm/response.rb', line 18

def success?
  code == 200
end