class NasaApi::Tech

Constants

PORT_URL
TRANSFER_URL

Public Instance Methods

port(params = {}) click to toggle source
# File lib/nasa_api/tech.rb, line 27
def port(params = {})
  # If id not passed, default to '', returning all projects
  params[:id] ||= ''
  id = params[:id].to_s
  params.delete(:id)
  params.merge!(@options)

  response = HTTParty.get(PORT_URL + id, query: params)
  if response.code == 200
    ResponseHandler::TechPort.new(response)
  else
    Error.new(response)
  end
end
transfer(params = {}) click to toggle source
# File lib/nasa_api/tech.rb, line 6
def transfer(params = {})
  # Query type must be appended to url like type/ instead of as parameter
  # if type is not passed, assume a patent type is requested
  params[:type] ||= 'patent'
  type = params[:type].to_s 
  params.delete(:type)

  # If item is not passed, default to '', returning all items
  params[:item] ||= ''
  item = params[:item].to_s
  params.delete(:item)
  params.merge!(@options)

  response = HTTParty.get(TRANSFER_URL + type + '/?' + item, query: params)
  if response.code == 200
    ResponseHandler::TechTransfer.new(response)
  else
    Error.new(response)
  end
end