Sha256: c78bd6d1c4c7ff89e19be0ecb7fc33c93ba783c74907c04eca0b6b3258348bd5

Contents?: true

Size: 727 Bytes

Versions: 4

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Oura
  module Utils
    # ::Oura::Utils::Api is utility api module.
    module Api
      private

      # @param [<String>] date
      # @param [<Date>] date
      # @return [String] date string
      def transform_date(date)
        return Date.parse(date).strftime('%Y-%m-%d') if date.is_a?(String)
        return date.strftime('%Y-%m-%d') if date.is_a?(Date)

        raise ArgumentError, 'invalid date'
      end

      # @param [String] path
      # @param [Hash] params
      # @return [OAuth2::Response]
      def get(path, params = {})
        raise StandardError, 'Not found access_token' if @access_token.nil?

        @access_token.get(path, params)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
oura-0.1.8 lib/oura/utils/api.rb
oura-0.1.7 lib/oura/utils/api.rb
oura-0.1.6 lib/oura/utils/api.rb
oura-0.1.5 lib/oura/utils/api.rb