Class: Nehm::HTTPClient
- Inherits:
-
Object
- Object
- Nehm::HTTPClient
- Defined in:
- lib/nehm/http_client.rb
Defined Under Namespace
Classes: ConnectionError, Status404
Constant Summary collapse
- CLIENT_ID =
SoundCloud API client ID
'11a37feb6ccc034d5975f3f803928a32'
Instance Method Summary collapse
Instance Method Details
#get(api_version, uri_string) ⇒ Object
19 20 21 22 |
# File 'lib/nehm/http_client.rb', line 19 def get(api_version, uri_string) uri = form_uri(api_version, uri_string) get_hash(uri) end |
#resolve(url) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/nehm/http_client.rb', line 24 def resolve(url) response = get(1, "/resolve?url=#{url}") errors = response['errors'] if errors if errors[0]['error_message'] =~ /404/ raise Status404 else raise ConnectionError # HACK end end get_hash(response['location']) if response['status'] =~ /302/ end |