Class: Freesound::Client::Response::Base

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/freesound/client.rb

Direct Known Subclasses

CombinedSearch, Pack, Search, Sound, User

Instance Method Summary collapse

Constructor Details

#initialize(response, http) ⇒ Base

Returns a new instance of Base.



79
80
81
82
# File 'lib/freesound/client.rb', line 79

def initialize(response, http)
  super(response)
  @http = http
end

Instance Method Details

#dataObject



84
85
86
# File 'lib/freesound/client.rb', line 84

def data
  @data ||= parse
end


88
89
90
91
92
93
94
# File 'lib/freesound/client.rb', line 88

def follow_link(name, into_class, **params)
  if url = data[name.to_s]
    into_class.new(@http.get(url, params: params), @http)
  else
    nil
  end
end