Class: Radio5::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/radio5/api.rb

Defined Under Namespace

Classes: Error, MatchingTrackNotFound, TrackNotFound, UnexpectedResponse, UserNotFound

Constant Summary collapse

HOST =
"radiooooo.com"
PORT =
443

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Api

Returns a new instance of Api.



16
17
18
# File 'lib/radio5/api.rb', line 16

def initialize(client:)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



14
15
16
# File 'lib/radio5/api.rb', line 14

def client
  @client
end

Instance Method Details

#get(path, query_params: {}, headers: {}) ⇒ Object



20
21
22
# File 'lib/radio5/api.rb', line 20

def get(path, query_params: {}, headers: {})
  request(Net::HTTP::Get, path, query_params, nil, headers)
end

#post(path, query_params: {}, body: nil, headers: {}) ⇒ Object



24
25
26
# File 'lib/radio5/api.rb', line 24

def post(path, query_params: {}, body: nil, headers: {})
  request(Net::HTTP::Post, path, query_params, body, headers)
end