Class: Arbetsformedlingen::API::Values::SoklistaPage

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/arbetsformedlingen/api/values/soklista_values.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



28
29
30
31
32
33
34
# File 'lib/arbetsformedlingen/api/values/soklista_values.rb', line 28

def method_missing(method_name, *arguments, &block)
  if response.respond_to?(method_name)
    response.public_send(method_name, *arguments, &block)
  else
    super
  end
end

Instance Method Details

#each(&block) ⇒ Object



17
18
19
# File 'lib/arbetsformedlingen/api/values/soklista_values.rb', line 17

def each(&block)
  data.each(&block)
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/arbetsformedlingen/api/values/soklista_values.rb', line 36

def respond_to_missing?(method_name, include_private = false)
  response.respond_to?(method_name) || super
end

#to_hObject



21
22
23
24
25
26
# File 'lib/arbetsformedlingen/api/values/soklista_values.rb', line 21

def to_h
  hash = super.to_h
  hash.delete(:response) # don't return the raw response object
  hash[:data].map!(&:to_h)
  hash
end