Module: FreeMusicArchive::Request

Included in:
Client
Defined in:
lib/freemusicarchive/request.rb

Overview

Defines HTTP request methods

Instance Method Summary collapse

Instance Method Details

#get(path, options = {}, unformatted = false) ⇒ Object

Perform an HTTP GET request



8
9
10
11
12
13
14
15
16
# File 'lib/freemusicarchive/request.rb', line 8

def get(path, options={}, unformatted=false)
  response = connection.get do |req|
    req.url(formatted_path(path), options)
    if api_key != nil
      req.params['api_key'] = api_key
    end
  end
  response.body.data
end