Module: CobotClient::UrlHelper
- Included in:
- NavigationLinkService
- Defined in:
- lib/cobot_client/url_helper.rb
Instance Method Summary collapse
-
#cobot_url(subdomain = 'www', *path_options) ⇒ Object
generates a url to access the cobot api see the spec for usage examples.
Instance Method Details
#cobot_url(subdomain = 'www', *path_options) ⇒ Object
generates a url to access the cobot api see the spec for usage examples
10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/cobot_client/url_helper.rb', line 10 def cobot_url(subdomain = 'www', *) path = .first.is_a?(String) ? .first : '/' = .find{|p| p.is_a?(Hash)} || {} url = URI.parse(site || 'https://www.cobot.me') url.host = url.host.split('.').tap{|parts| parts[0] = subdomain}.join('.') url.path = path url.query = URI.encode_www_form([:params]) if [:params] url.to_s end |