<commit_before>require 'checkmate_ruby/configuration'
require 'checkmate_ruby/property_params'
require 'checkmate_ruby/reservations_params'
require 'json'
require 'hashie/mash'
require 'typhoeus'

module Checkmate
  class Client
    include Typhoeus
    extend Configuration

    attr_accessor *Configuration::VALID_OPTIONS

    def initialize(options = {})
      merged_options = Checkmate::Client.options.merge(options)
      Configuration::VALID_OPTIONS.each do |key|
        public_send("#{key}=", merged_options[key])
      end
    end

    def get_property(property_params)
      property_params = Checkmate::PropertyParams.new(property_params)
      request = create_request("get", property_params)
      handle_response(request.run)
    end

    def list_reservations(reservations_params)
      reservations_params = Checkmate::ReservationsParams.new(reservations_params)
      request = create_request("get", reservations_params)
      handle_response(request.run) 
    end

    def show_reservation(reservation_id)
      reservations_params = Checkmate::ReservationsParams.new( \
          {:reservation_id => reservation_id})
      request = create_request("get", reservations_params)
      handle_response(request.run) 
    end

    private
      def create_request(method, resource)
        Request.new(
          specific_uri(resource),
          method: method.to_sym,
          params: resource.to_uri_params,
          headers: headers,
          followlocation: true)
      end

      def headers
        headers = {
          "Accept" => "application/json",
          "X-CheckMate-API-Token" => private_key
        }
      end<commit_msg>default arg value for listing reservations<commit_after>require 'checkmate_ruby/configuration'
require 'checkmate_ruby/property_params'
require 'checkmate_ruby/reservations_params'
require 'json'
require 'hashie/mash'
require 'typhoeus'

module Checkmate
  class Client
    include Typhoeus
    extend Configuration

    attr_accessor *Configuration::VALID_OPTIONS

    def initialize(options = {})
      merged_options = Checkmate::Client.options.merge(options)
      Configuration::VALID_OPTIONS.each do |key|
        public_send("#{key}=", merged_options[key])
      end
    end

    def get_property(property_params)
      property_params = Checkmate::PropertyParams.new(property_params)
      request = create_request("get", property_params)
      handle_response(request.run)
    end

    def list_reservations(reservations_params = {})
      reservations_params = Checkmate::ReservationsParams.new(reservations_params)
      request = create_request("get", reservations_params)
      handle_response(request.run) 
    end

    def show_reservation(reservation_id)
      reservations_params = Checkmate::ReservationsParams.new({:reservation_id => reservation_id})
      request = create_request("get", reservations_params)
      handle_response(request.run) 
    end

    private
      def create_request(method, resource)
        Request.new(
          specific_uri(resource),
          method: method.to_sym,
          params: resource.to_uri_params,
          headers: headers,
          followlocation: true)
      end

      def headers
        headers = {
          "Accept" => "application/json",
          "X-CheckMate-API-Token" => private_key
        }
      end
{'fraction_non_alphanumeric': 0.0863568215892054, 'fraction_numerical': 0.0, 'mean_word_length': 3.3156532988357053, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5690261', 'n_tokens_mistral': 954, 'n_tokens_neox': 931, 'n_words': 173}