Module: FedSpending::Client::Api

Included in:
FedSpending::Client
Defined in:
lib/fed_spending/client/api.rb

Instance Method Summary collapse

Instance Method Details

#faads(params = {}, options = {}) ⇒ Hash

Allows access to modified FAADS data on Federal contracts.

Examples:

faads({:detail => -1, :recipient_name => 'Smith', :fiscal_year => 2006})

Parameters:

  • params (Hash) (defaults to: {})

    The parameters for the lookup

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

See Also:



61
62
63
64
65
66
67
68
69
70
71
# File 'lib/fed_spending/client/api.rb', line 61

def faads(params={}, options={})
  if !params[:sort_by].nil?
    params["sortby"] = params[:sort_by]
    params.delete(:sort_by)
  end
  request = []
  params.each do|key, value|
    request << "#{key.to_s}=#{value.to_s}"
  end
  get("faads/faads.php?datype=X&#{request.join('&')}")
end

#fpds(params = {}, options = {}) ⇒ Hash

Allows access to modified FPDS data on Federal contracts.

Examples:

fpds({:detail => -1, :state => 'AL'})

Parameters:

  • params (Hash) (defaults to: {})

    The parameters for the lookup

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

See Also:



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/fed_spending/client/api.rb', line 13

def fpds(params={}, options={})
  if !params[:zip_code].nil?
    params["ZIPCode"] = params[:zip_code]
    params.delete(:zip_code)
  end
  if !params[:vendor_country_code].nil?
    params["vendorCountryCode"] = params[:vendor_country_code]
    params.delete(:vendor_country_code)
  end
  if !params[:state_code].nil?
    params["stateCode"] = params[:state_code]
    params.delete(:state_code)
  end
  if !params[:place_of_performance_zip_code].nil?
    params["placeOfPerformanceZIPCode"] = params[:place_of_performance_zip_code]
    params.delete(:place_of_performance_zip_code)
  end
  if !params[:place_of_performance_country_code].nil?
    params["placeOfPerformanceCountryCode"] = params[:place_of_performance_country_code]
    params.delete(:place_of_performance_country_code)
  end
  if !params[:description_of_contract_requirement].nil?
    params["descriptionOfContractRequirement"] = params[:description_of_contract_requirement]
    params.delete(:description_of_contract_requirement)
  end
  if !params[:piid].nil?
    params["PIID"] = params[:piid]
    params.delete(:piid)
  end
  if !params[:sort_by].nil?
    params["sortby"] = params[:sort_by]
    params.delete(:sort_by)
  end
  request = []
  params.each do|key, value|
    request << "#{key.to_s}=#{value.to_s}"
  end
  get("fpds/fpds.php?datype=X&#{request.join('&')}")
end

#rcv(params = {}, options = {}) ⇒ Hash

Allows access to modified recovery data on Federal contracts.

Examples:

rcv({:detail => -1, :recipient_state => 'IA'})

Parameters:

  • params (Hash) (defaults to: {})

    The parameters for the lookup

  • options (Hash) (defaults to: {})

    A customizable set of options.

Returns:

  • (Hash)

See Also:



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/fed_spending/client/api.rb', line 81

def rcv(params={}, options={})
  if !params[:sort_by].nil?
    params["sortp"] = params[:sort_by]
    params.delete(:sort_by)
  end
  if !params[:recipient_state].nil?
    params["recipient_st"] = params[:recipient_state]
    params.delete(:recipient_state)
  end
  request = []
  params.each do|key, value|
    request << "#{key.to_s}=#{value.to_s}"
  end
  get("rcv/rcv.php?datype=X&#{request.join('&')}")
end