lib/fitgem/notifications.rb
def make_subscription_url(opts)
      validate_subscription_type opts[:type]
      path = if opts[:type] == :all
        ""
      else
        "/"+opts[:type].to_s
      end
      url = "/user/#{@user_id}#{path}/apiSubscriptions"
      if opts[:use_subscription_id]
        unless opts[:subscription_id]
          raise Fitgem::InvalidArgumentError, "Must include options[:subscription_id]"
        end
        url += "/#{opts[:subscription_id]}"
      end
      url += ".json"
    end
# Create the subscription management API url
#
# @param [Hash] opts The options on how to construct the
#   subscription API url
# @option opts [Symbol] :type The type of subscription;
#   valid values are (:sleep, :body, :activities, :foods, and
#   :all)
# @option opts [Symbol] :use_subscription_id If true, then
#   opts[:subscription_id] will be used in url construction
# @option opts [String] :subscription_id The id of the subscription
#   that the URL is for
# @return [String] The url to use for subscription management
Create the subscription management API url
Create the subscription management API url
def make_subscription_url(opts)
      validate_subscription_type opts[:type]
      path = if opts[:type] == :all
        ""
      else
        "/"+opts[:type].to_s
      end
      url = "/user/#{@user_id}#{path}/apiSubscriptions"
      if opts[:use_subscription_id]
        unless opts[:subscription_id]
          raise Fitgem::InvalidArgumentError, "Must include options[:subscription_id]"
        end
        url += "/#{opts[:subscription_id]}"
      end
      url += ".json"
    end
def make_subscription_url ( opts ) validate_subscription_type opts [ :type ] path = if opts [ :type ] == :all "" else "/" + opts [ :type ] . to_s end url = "/user/#{@user_id}#{path}/apiSubscriptions" if opts [ :use_subscription_id ] unless opts [ :subscription_id ] raise Fitgem :: InvalidArgumentError , "Must include options[:subscription_id]" end url += "/#{opts[:subscription_id]}" end url += ".json" end
Create the subscription management API url
Create the subscription management API url
The url to use for subscription management
The url to use for subscription management
String
opts
:subscription_id The id of the subscription that the URL is for
: subscription_id The id of the subscription that the URL is for
opts The options on how to construct the subscription API url
opts The options on how to construct the subscription API url