Class: SptyAPI::HTTP::Client
- Inherits:
-
Object
- Object
- SptyAPI::HTTP::Client
- Defined in:
- lib/spty_api/http/client.rb
Constant Summary collapse
- DEFAULT_API =
'https://api.spotify.com/v1/'
- CONTENT_TYPE =
'application/json'
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#api_overwrite ⇒ Object
Returns the value of attribute api_overwrite.
-
#body_parameter ⇒ Object
Returns the value of attribute body_parameter.
-
#content_type_overwrite ⇒ Object
Returns the value of attribute content_type_overwrite.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#http_method ⇒ Object
Returns the value of attribute http_method.
-
#path_parameter ⇒ Object
Returns the value of attribute path_parameter.
-
#query_parameter ⇒ Object
Returns the value of attribute query_parameter.
-
#token_type ⇒ Object
Returns the value of attribute token_type.
Instance Method Summary collapse
-
#initialize(http_method:, token_type:, access_token: nil, endpoint:) ⇒ Client
constructor
A new instance of Client.
- #request ⇒ Object
Constructor Details
#initialize(http_method:, token_type:, access_token: nil, endpoint:) ⇒ Client
Returns a new instance of Client.
15 16 17 18 19 20 |
# File 'lib/spty_api/http/client.rb', line 15 def initialize(http_method:, token_type:, access_token: nil, endpoint:) self.http_method = http_method self.token_type = token_type self.access_token = access_token self.endpoint = endpoint end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def access_token @access_token end |
#api_overwrite ⇒ Object
Returns the value of attribute api_overwrite.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def api_overwrite @api_overwrite end |
#body_parameter ⇒ Object
Returns the value of attribute body_parameter.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def body_parameter @body_parameter end |
#content_type_overwrite ⇒ Object
Returns the value of attribute content_type_overwrite.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def content_type_overwrite @content_type_overwrite end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def endpoint @endpoint end |
#http_method ⇒ Object
Returns the value of attribute http_method.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def http_method @http_method end |
#path_parameter ⇒ Object
Returns the value of attribute path_parameter.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def path_parameter @path_parameter end |
#query_parameter ⇒ Object
Returns the value of attribute query_parameter.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def query_parameter @query_parameter end |
#token_type ⇒ Object
Returns the value of attribute token_type.
8 9 10 |
# File 'lib/spty_api/http/client.rb', line 8 def token_type @token_type end |
Instance Method Details
#request ⇒ Object
22 23 24 25 26 |
# File 'lib/spty_api/http/client.rb', line 22 def request uri = prepare_uri http = prepare_http(uri) http.request(prepare_request(uri)) end |