Class: GoodGuide::Gibbon::RuntimeClient

Inherits:
AbstractClient show all
Includes:
Util
Defined in:
lib/goodguide/gibbon.rb

Instance Method Summary collapse

Methods included from Util

#hash_to_js, #hash_to_ruby, #obj_to_ruby

Methods inherited from AbstractClient

queries, query

Instance Method Details

#missing_data!Object

Raises:



258
259
260
# File 'lib/goodguide/gibbon.rb', line 258

def missing_data!
  raise MissingData.new(@last_query_type, @last_id, @last_annotations)
end

#perform_query(id, annotations, v) ⇒ Object



244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/goodguide/gibbon.rb', line 244

def perform_query(id, annotations, v)
  annotations = obj_to_ruby(annotations)

  query_type = annotations.delete('_query_type')

  # stash this data in case missing_data! is called
  @last_query_type = query_type
  @last_annotations = annotations
  @last_id = id

  query = get_query(query_type)
  instance_exec(id, annotations, v, &query)
end

#to_jsObject



262
263
264
# File 'lib/goodguide/gibbon.rb', line 262

def to_js
  { :performQuery => proc_for(:perform_query) }
end