Class: GdsApi::Needotron

Inherits:
Base
  • Object
show all
Defined in:
lib/gds_api/needotron.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#adapter_name, #client, #create_client, #initialize, #url_for_slug

Constructor Details

This class inherits a constructor from GdsApi::Base

Instance Method Details

#need_by_id(id, opts = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/gds_api/needotron.rb', line 4

def need_by_id(id, opts = {})
  response = get_json("#{base_url}/#{id}.json")
  return nil if response.nil? or response['need'].nil?

  if opts[:as_hash]
    response.to_hash
  else
    response.to_ostruct.need
  end
end