Class: Musicz::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/musicz/request.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config:) ⇒ Request

Returns a new instance of Request.



16
17
18
# File 'lib/musicz/request.rb', line 16

def initialize(config:)
  @config = config
end

Class Method Details

.build(config: default_config) ⇒ Object



12
13
14
# File 'lib/musicz/request.rb', line 12

def self.build(config: default_config)
  new(config: config)
end

.default_configObject



8
9
10
# File 'lib/musicz/request.rb', line 8

def self.default_config
  Musicz.config
end

Instance Method Details

#get(endpoint:, parameters:) ⇒ Object



20
21
22
23
# File 'lib/musicz/request.rb', line 20

def get(endpoint:, parameters:)
  url = "#{uri(endpoint)}?#{URI.encode_www_form(parameters)}"
  Typhoeus.get(url, headers: headers)
end