Sha256: 2fb1a8bd6fbd306946802cccefa4e5560371aadc4027aeac09878679fee15dc9

Contents?: true

Size: 746 Bytes

Versions: 4

Compression:

Stored size: 746 Bytes

Contents

# This class handles the HTTP interactions with the Yummly API calls.
module Yummly
  class UrlBuilder

    class << self

      def domain
        "#{self.protocol}://api.yummly.com"
      end

      def uri(command, params = {})
        query_string = self.build_params_query_string(params)
        "/#{self.api_version}/api/#{command}?#{query_string}"
      end

      def build_params_query_string(params = {})
        params['_app_id'] = Yummly.configuration.app_id
        params['_app_key'] = Yummly.configuration.app_key
        Rack::Utils.build_query(params)
      end

      def protocol
        Yummly.configuration.use_ssl? ? 'https' : 'http'
      end

      def api_version
        Yummly::API_VERSION
      end

    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
yummly-0.0.13 lib/yummly/url_builder.rb
yummly-0.0.12 lib/yummly/url_builder.rb
yummly-0.0.11 lib/yummly/url_builder.rb
yummly-0.0.10 lib/yummly/url_builder.rb