Class: GoodGuide::Gibbon::Dependency::Query

Inherits:
GoodGuide::Gibbon::Dependency show all
Defined in:
lib/goodguide/gibbon.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(info = {}) ⇒ Query

Returns a new instance of Query.



415
416
417
418
419
420
421
# File 'lib/goodguide/gibbon.rb', line 415

def initialize(info={})
  @query_type = info.fetch(:query_type) { raise "no query type" }
  @annotations = info.fetch(:annotations) { raise "no annotations" }
  @type = info.fetch(:type) { raise "no type" }
  @id = info.fetch(:id) { raise "no id" }
  @value = info.fetch(:value) { raise "no value" }
end

Instance Attribute Details

#annotationsObject (readonly)

Returns the value of attribute annotations.



414
415
416
# File 'lib/goodguide/gibbon.rb', line 414

def annotations
  @annotations
end

#idObject (readonly)

Returns the value of attribute id.



414
415
416
# File 'lib/goodguide/gibbon.rb', line 414

def id
  @id
end

#query_typeObject (readonly)

Returns the value of attribute query_type.



414
415
416
# File 'lib/goodguide/gibbon.rb', line 414

def query_type
  @query_type
end

#typeObject (readonly)

Returns the value of attribute type.



414
415
416
# File 'lib/goodguide/gibbon.rb', line 414

def type
  @type
end

#valueObject (readonly)

Returns the value of attribute value.



414
415
416
# File 'lib/goodguide/gibbon.rb', line 414

def value
  @value
end

Instance Method Details

#as_jsonObject



423
424
425
426
427
428
429
430
431
432
# File 'lib/goodguide/gibbon.rb', line 423

def as_json
  {
    '_tag' => 'query',
    'query_type' => query_type,
    'annotations' => annotations,
    'type' => type,
    'id' => id,
    'value' => value
  }
end