lib/unsplash/connection.rb in unsplash-2.0.1 vs lib/unsplash/connection.rb in unsplash-2.1.0

- old
+ new

@@ -92,19 +92,27 @@ # @param params [Hash] A hash of request parameters. def delete(path, params = {}) request :delete, path, params end + def utm_params + { + "utm_source" => Unsplash.configuration.utm_source || "api_app", + "utm_medium" => "referral", + "utm_campaign" => "api-credit" + } + end + private def request(verb, path, params = {}) raise ArgumentError.new "Invalid http verb #{verb}" if ![:get, :post, :put, :delete].include?(verb) params.merge!(utm_params) if !Unsplash.configuration.utm_source - url = "https://community.unsplash.com/developersblog/unsplash-api-guidelines" + url = "https://help.unsplash.com/api-guidelines/unsplash-api-guidelines" Unsplash.configuration.logger.warn "utm_source is required as part of API Terms: #{url}" end headers = { "Accept-Version" => @api_version @@ -146,17 +154,9 @@ response end def public_auth_header { "Authorization" => "Client-ID #{@application_access_key}" } - end - - def utm_params - { - utm_source: Unsplash.configuration.utm_source || "api_app", - utm_medium: "referral", - utm_campaign: "api-credit" - } end def refresh_token! return if !@oauth_token.expired?