Class: MailchimpAPI::URIBuilder Private
- Inherits:
-
Object
- Object
- MailchimpAPI::URIBuilder
- Defined in:
- lib/mailchimp-api/uri_builder.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Internal class for building and manipulating URIs
Class Method Summary collapse
-
.call(url:, path:, query:) ⇒ URI
private
Builds a URI from base URL, path, and query parameters.
Class Method Details
.call(url:, path:, query:) ⇒ URI
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Builds a URI from base URL, path, and query parameters
19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/mailchimp-api/uri_builder.rb', line 19 def call(url:, path:, query:) uri = if path.start_with?("/") call(url: url, path: path[1, path.size - 1], query: nil) elsif path.start_with?("0", "1", "2", "3", "4", "5", "6", "7", "8", "9") URI.join(url, "/" + path) else URI.join(url, path) end add_query_params(uri, query) uri end |