Class: NexosisApi::ModelListQuery

Inherits:
ListQuery
  • Object
show all
Defined in:
lib/nexosis_api/list_queries.rb

Overview

Note:

sort by properties include id, modelName, dataSourceName, type, createdDate, and lastUsedDate

class to hold the query options for list models

Instance Attribute Summary collapse

Attributes inherited from ListQuery

#page_number, #page_size, #sort_by, #sort_order

Instance Method Summary collapse

Methods inherited from ListQuery

#to_hash

Constructor Details

#initialize(options = {}) ⇒ ModelListQuery

Returns a new instance of ModelListQuery.

Since:

  • 3.0.0



134
135
136
137
138
139
# File 'lib/nexosis_api/list_queries.rb', line 134

def initialize(options = {})
  @datasource_name = options[:datasource_name] if options.key? :datasource_name
  @created_after_date = options[:created_after_date] if options.key? :created_after_date
  @created_before_date = options[:created_before_date] if options.key? :created_before_date
  super(options, :datasource_name, :created_after_date, :created_before_date)
end

Instance Attribute Details

#created_after_dateString

Format - date-time (as date-time in ISO8601). Limits models to those created on or after the specified date

Returns:

  • (String)

Since:

  • 3.0.0



157
158
159
# File 'lib/nexosis_api/list_queries.rb', line 157

def created_after_date
  @created_after_date
end

#created_before_dateString

Format - date-time (as date-time in ISO8601). Limits models to those created on or before the specified date

Returns:

  • (String)

Since:

  • 3.0.0



161
162
163
# File 'lib/nexosis_api/list_queries.rb', line 161

def created_before_date
  @created_before_date
end

#datasource_nameString

Limits models to those for a particular data source

Returns:

  • (String)

Since:

  • 3.0.0



153
154
155
# File 'lib/nexosis_api/list_queries.rb', line 153

def datasource_name
  @datasource_name
end

Instance Method Details

#query_parametersHash

A hash suitable for using as the query portion of an HTTP request to the API

Returns:

  • (Hash)

Since:

  • 3.0.0



143
144
145
146
147
148
149
# File 'lib/nexosis_api/list_queries.rb', line 143

def query_parameters
  parm_hash = {}
  parm_hash.store(:dataSourceName, @datasource_name) unless @datasource_name.nil?
  parm_hash.store(:createdAfterDate, date_string(@created_after_date)) unless @created_after_date.nil?
  parm_hash.store(:createdBeforeDate, date_string(@created_before_date)) unless @created_before_date.nil?
  self.to_hash.merge(parm_hash)
end