Class: SoilSidekick::SoilAnalysisApi

Inherits:
Object
  • Object
show all
Defined in:
lib/soilsidekick/api/soil_analysis_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.default) ⇒ SoilAnalysisApi

Returns a new instance of SoilAnalysisApi.



19
20
21
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 19

def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



17
18
19
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 17

def api_client
  @api_client
end

Instance Method Details

#get_live_agricultural_data(get_live_agricultural_data_request, opts = {}) ⇒ LiveAgriculturalData

Get live agricultural data Fetch real-time agricultural data from multiple federal sources (NOAA, USDA, EPA)

Parameters:

Returns:



27
28
29
30
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 27

def get_live_agricultural_data(get_live_agricultural_data_request, opts = {})
  data, _status_code, _headers = get_live_agricultural_data_with_http_info(get_live_agricultural_data_request, opts)
  data
end

#get_live_agricultural_data_with_http_info(get_live_agricultural_data_request, opts = {}) ⇒ Array<(LiveAgriculturalData, Integer, Hash)>

Get live agricultural data Fetch real-time agricultural data from multiple federal sources (NOAA, USDA, EPA)

Parameters:

Returns:

  • (Array<(LiveAgriculturalData, Integer, Hash)>)

    LiveAgriculturalData data, response status code and response headers



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 37

def get_live_agricultural_data_with_http_info(get_live_agricultural_data_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SoilAnalysisApi.get_live_agricultural_data ...'
  end
  # verify the required parameter 'get_live_agricultural_data_request' is set
  if @api_client.config.client_side_validation && get_live_agricultural_data_request.nil?
    fail ArgumentError, "Missing the required parameter 'get_live_agricultural_data_request' when calling SoilAnalysisApi.get_live_agricultural_data"
  end
  # resource path
  local_var_path = '/live-agricultural-data'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(get_live_agricultural_data_request)

  # return_type
  return_type = opts[:debug_return_type] || 'LiveAgriculturalData'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SoilAnalysisApi.get_live_agricultural_data",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SoilAnalysisApi#get_live_agricultural_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_planting_calendar(get_planting_calendar_request, opts = {}) ⇒ PlantingCalendar

Get planting calendar recommendations Multi-parameter planting calendar with climate and soil factors

Parameters:

Options Hash (opts):

  • :x_tq_context_mode (Integer)

    TurboQuant extended context window size (tokens). With 3-bit KV cache, context windows up to 24K tokens are feasible within the same memory budget as standard 4K. (default to 4096)

  • :x_tq_kv_cache_hint (String)

    KV cache management hint. - &#x60;none&#x60;: No caching (default) - &#x60;reuse&#x60;: Reuse KV cache from previous request in same session (40-60% compute savings) - &#x60;persist&#x60;: Persist cache to disk for cross-session reuse (default to ‘none’)

  • :x_tq_model_tier (String)

    Preferred model tier for inference. - &#x60;auto&#x60;: Server selects optimal model based on device capabilities - &#x60;gemma-2b&#x60;: Lightweight model (~0.5GB KV with TQ) - &#x60;gemma-7b&#x60;: Full model, standard KV cache - &#x60;gemma-7b-tq&#x60;: Full model with TurboQuant 3-bit KV cache (~1.3GB) (default to ‘auto’)

Returns:



98
99
100
101
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 98

def get_planting_calendar(get_planting_calendar_request, opts = {})
  data, _status_code, _headers = get_planting_calendar_with_http_info(get_planting_calendar_request, opts)
  data
end

#get_planting_calendar_with_http_info(get_planting_calendar_request, opts = {}) ⇒ Array<(PlantingCalendar, Integer, Hash)>

Get planting calendar recommendations Multi-parameter planting calendar with climate and soil factors

Parameters:

Options Hash (opts):

  • :x_tq_context_mode (Integer)

    TurboQuant extended context window size (tokens). With 3-bit KV cache, context windows up to 24K tokens are feasible within the same memory budget as standard 4K. (default to 4096)

  • :x_tq_kv_cache_hint (String)

    KV cache management hint. - &#x60;none&#x60;: No caching (default) - &#x60;reuse&#x60;: Reuse KV cache from previous request in same session (40-60% compute savings) - &#x60;persist&#x60;: Persist cache to disk for cross-session reuse (default to ‘none’)

  • :x_tq_model_tier (String)

    Preferred model tier for inference. - &#x60;auto&#x60;: Server selects optimal model based on device capabilities - &#x60;gemma-2b&#x60;: Lightweight model (~0.5GB KV with TQ) - &#x60;gemma-7b&#x60;: Full model, standard KV cache - &#x60;gemma-7b-tq&#x60;: Full model with TurboQuant 3-bit KV cache (~1.3GB) (default to ‘auto’)

Returns:

  • (Array<(PlantingCalendar, Integer, Hash)>)

    PlantingCalendar data, response status code and response headers



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 111

def get_planting_calendar_with_http_info(get_planting_calendar_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SoilAnalysisApi.get_planting_calendar ...'
  end
  # verify the required parameter 'get_planting_calendar_request' is set
  if @api_client.config.client_side_validation && get_planting_calendar_request.nil?
    fail ArgumentError, "Missing the required parameter 'get_planting_calendar_request' when calling SoilAnalysisApi.get_planting_calendar"
  end
  allowable_values = [4096, 8192, 16384, 24576]
  if @api_client.config.client_side_validation && opts[:'x_tq_context_mode'] && !allowable_values.include?(opts[:'x_tq_context_mode'])
    fail ArgumentError, "invalid value for \"x_tq_context_mode\", must be one of #{allowable_values}"
  end
  allowable_values = ["none", "reuse", "persist"]
  if @api_client.config.client_side_validation && opts[:'x_tq_kv_cache_hint'] && !allowable_values.include?(opts[:'x_tq_kv_cache_hint'])
    fail ArgumentError, "invalid value for \"x_tq_kv_cache_hint\", must be one of #{allowable_values}"
  end
  allowable_values = ["auto", "gemma-2b", "gemma-7b", "gemma-7b-tq"]
  if @api_client.config.client_side_validation && opts[:'x_tq_model_tier'] && !allowable_values.include?(opts[:'x_tq_model_tier'])
    fail ArgumentError, "invalid value for \"x_tq_model_tier\", must be one of #{allowable_values}"
  end
  # resource path
  local_var_path = '/multi-parameter-planting-calendar'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end
  header_params[:'x-tq-context-mode'] = opts[:'x_tq_context_mode'] if !opts[:'x_tq_context_mode'].nil?
  header_params[:'x-tq-kv-cache-hint'] = opts[:'x_tq_kv_cache_hint'] if !opts[:'x_tq_kv_cache_hint'].nil?
  header_params[:'x-tq-model-tier'] = opts[:'x_tq_model_tier'] if !opts[:'x_tq_model_tier'].nil?

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(get_planting_calendar_request)

  # return_type
  return_type = opts[:debug_return_type] || 'PlantingCalendar'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SoilAnalysisApi.get_planting_calendar",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SoilAnalysisApi#get_planting_calendar\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_soil_data(get_soil_data_request, opts = {}) ⇒ SoilData

Get soil analysis data Retrieve comprehensive soil analysis for a specific county

Parameters:

  • get_soil_data_request (GetSoilDataRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:



184
185
186
187
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 184

def get_soil_data(get_soil_data_request, opts = {})
  data, _status_code, _headers = get_soil_data_with_http_info(get_soil_data_request, opts)
  data
end

#get_soil_data_with_http_info(get_soil_data_request, opts = {}) ⇒ Array<(SoilData, Integer, Hash)>

Get soil analysis data Retrieve comprehensive soil analysis for a specific county

Parameters:

  • get_soil_data_request (GetSoilDataRequest)
  • opts (Hash) (defaults to: {})

    the optional parameters

Returns:

  • (Array<(SoilData, Integer, Hash)>)

    SoilData data, response status code and response headers



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
# File 'lib/soilsidekick/api/soil_analysis_api.rb', line 194

def get_soil_data_with_http_info(get_soil_data_request, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: SoilAnalysisApi.get_soil_data ...'
  end
  # verify the required parameter 'get_soil_data_request' is set
  if @api_client.config.client_side_validation && get_soil_data_request.nil?
    fail ArgumentError, "Missing the required parameter 'get_soil_data_request' when calling SoilAnalysisApi.get_soil_data"
  end
  # resource path
  local_var_path = '/get-soil-data'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
  # HTTP header 'Content-Type'
  content_type = @api_client.select_header_content_type(['application/json'])
  if !content_type.nil?
      header_params['Content-Type'] = content_type
  end

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(get_soil_data_request)

  # return_type
  return_type = opts[:debug_return_type] || 'SoilData'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKeyAuth']

  new_options = opts.merge(
    :operation => :"SoilAnalysisApi.get_soil_data",
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: SoilAnalysisApi#get_soil_data\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end