Class: Musicz::Request
- Inherits:
-
Object
- Object
- Musicz::Request
- Defined in:
- lib/musicz/request.rb
Class Method Summary collapse
Instance Method Summary collapse
- #get(endpoint:, parameters:) ⇒ Object
-
#initialize(config:) ⇒ Request
constructor
A new instance of Request.
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 |
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 |