Class: Cdss::Client

Inherits:
Object
  • Object
show all
Includes:
AdminCalls, Analysis, Climate, GroundWater, ReferenceTables, Structures, SurfaceWater, Telemetry, WaterRights, HTTParty
Defined in:
lib/cdss/client.rb

Overview

Main client class for interacting with the CDSS API.

The Client class provides access to all CDSS API endpoints and handles authentication, request configuration, and response processing.

Examples:

Create a new client

client = Cdss::Client.new(api_key: "your-api-key")
client.get_climate_stations(county: "Denver")

Constant Summary

Constants included from ReferenceTables

ReferenceTables::VALID_TABLES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ReferenceTables

#get_reference_table

Methods included from Utils

#batch_dates, #build_query, #fetch_paginated_data, #format_date, #format_query_param, #parse_timestamp, #safe_float, #safe_integer

Methods included from WaterRights

#get_water_rights_net_amounts, #get_water_rights_transactions

Methods included from Telemetry

#get_telemetry_stations, #get_telemetry_ts

Methods included from SurfaceWater

#get_sw_stations, #get_sw_ts

Methods included from Structures

#get_diversion_records_ts, #get_stage_volume_ts, #get_structures, #get_water_classes

Methods included from GroundWater

#get_geophysical_log_picks, #get_geophysical_log_wells, #get_water_level_wells, #get_well_measurements

Methods included from Climate

#get_climate_frost_dates, #get_climate_stations, #get_climate_ts, #get_climate_ts_day, #get_climate_ts_month

Methods included from Analysis

#get_call_analysis_gnisid, #get_call_analysis_wdid, #get_source_route_analysis, #get_source_route_framework

Methods included from AdminCalls

#get_admin_calls

Constructor Details

#initialize(api_key: nil, **options) ⇒ Client

Initialize a new CDSS API client.

Parameters:

  • api_key (String, nil) (defaults to: nil)

    API key for authentication

  • options (Hash)

    Additional options for configuring the client



37
38
39
40
41
# File 'lib/cdss/client.rb', line 37

def initialize(api_key: nil, **options)
  @options = options
  @api_key = api_key
  setup_client
end

Instance Attribute Details

#api_keyString?

Returns API key for authentication.

Returns:

  • (String, nil)

    API key for authentication



30
31
32
# File 'lib/cdss/client.rb', line 30

def api_key
  @api_key
end

#optionsHash (readonly)

Returns Additional options passed to the client.

Returns:

  • (Hash)

    Additional options passed to the client



27
28
29
# File 'lib/cdss/client.rb', line 27

def options
  @options
end