class Ucb::Hcm::Response

Attributes

raw_response[R]

Public Class Methods

new(raw_response) click to toggle source
# File lib/ucb/hcm/response.rb, line 13
def initialize(raw_response)
  @raw_response = raw_response
end

Public Instance Methods

all() click to toggle source
# File lib/ucb/hcm/response.rb, line 25
def all
  raw_response&.fetch("response", []) || []
end
all_fetchers() click to toggle source
# File lib/ucb/hcm/response.rb, line 29
def all_fetchers
  all.map { |item| Ucb::Hcm::DataFetcher.new(item) }
end
data() click to toggle source
# File lib/ucb/hcm/response.rb, line 49
def data
  warn "Ucb::Hcm#data is deprecated and will be removed in future versions - use #raw_response['response'] instead"
  if raw_response["response"]&.count == 1
    raw_response["response"]&.first
  else
    raw_response["response"]
  end
end
each() { |item| ... } click to toggle source
# File lib/ucb/hcm/response.rb, line 33
def each
  all.each { |item| yield item }
end
each_fetcher() { |data_fetcher| ... } click to toggle source
# File lib/ucb/hcm/response.rb, line 37
def each_fetcher
  all.each { |item| yield Ucb::Hcm::DataFetcher.new(item) }
end
raw() click to toggle source
# File lib/ucb/hcm/response.rb, line 21
def raw
  raw_response
end
response() click to toggle source

deprecations

# File lib/ucb/hcm/response.rb, line 44
def response
  warn "Ucb::Hcm#response is deprecated and will be removed in future versions - use #raw_response instead"
  raw_response
end
success?() click to toggle source
# File lib/ucb/hcm/response.rb, line 17
def success?
  code == 200
end