Module: Samwise::Protocol

Defined in:
lib/samwise/protocol.rb

Constant Summary collapse

SAM_API_BASE_URL =
'https://api.data.gov'
SAM_API_API_VERSION =
'v4'
SAM_STATUS_URL =
'https://www.sam.gov/samdata/registrations/trackProgress'
SAM_STATUS_KEY =
'1452031543862'
NAICS_WHITELIST =
[511210, 541511, 541512, 541519, 334614]
FAR_SMALL_BIZ_CITATION =
'FAR 52.219-1'

Class Method Summary collapse

Class Method Details

.duns_url(duns: nil, api_key: nil) ⇒ Object



10
11
12
13
14
15
# File 'lib/samwise/protocol.rb', line 10

def self.duns_url(duns: nil, api_key: nil)
  fail Samwise::Error::ArgumentMissing, 'DUNS number is missing' if duns.nil?
  fail Samwise::Error::ArgumentMissing, 'SAM.gov API key is missing' if api_key.nil?

  "#{SAM_API_BASE_URL}/sam/#{SAM_API_API_VERSION}/registrations/#{duns}?api_key=#{api_key}"
end

.sam_status_url(duns: nil, api_key: nil) ⇒ Object



17
18
19
20
21
22
# File 'lib/samwise/protocol.rb', line 17

def self.sam_status_url(duns: nil, api_key: nil)
  fail Samwise::Error::ArgumentMissing, 'DUNS number is missing' if duns.nil?
  fail Samwise::Error::ArgumentMissing, 'SAM status key is missing' if api_key.nil?

  "#{SAM_STATUS_URL}/?duns=#{duns}&_=#{api_key}"
end