3

I'm trying to the run the ruby version of the program to consume GOV data sources located at : http://usdepartmentoflabor.github.io/Ruby-Sample-App/ .

I get two errors. The first has to do with an incorrect number of arguments being passed in. This is easily rectified by removing the API_SECRET argument.

.../dol/GOVDataSDK.rb:24:in `initialize': wrong number of arguments (5 for 4)     (ArgumentError)
from GOVDataExample.rb:9:in `new'
from GOVDataExample.rb:9:in `<main>'

The second error has to do with the actual constructed URL. It seem to be invalid.

$ ruby GOVDataExample.rb
.../.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:176:in `split': bad URI(is not  URI?): http://api.dol.gov/V1/SummerJobs/getJobsListing?KEY={@context.key}? format='json'&query='farm'&region=&locality=&skipcount=1 (URI::InvalidURIError)
from /Users/sunraa/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:211:in `parse'
from /Users/sunraa/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:747:in `parse'
from /Users/sunraa/Dropbox/Work/epa/teaser/dol/GOVDataSDK.rb:95:in `block (2 levels) in call_api'

Any help would be appreciated.

  • You might try also posting your issues to the code repo that stores this example: github.com/USDepartmentofLabor/Ruby-Sample-App – Mark Silverberg Sep 25 '14 at 21:16
  • It looks like the Ruby example you linked to is out of date. You can see that their more recently updated repo has code where the DataContext class has a different signature and probably other changes as well. Messy. – Mark Silverberg Sep 25 '14 at 21:21
  • Thanks for your help. I had used the DataContext from the repo and tried the included sample. Same results. Will keep digging. – Suresh Rao Sep 25 '14 at 23:07
  • There has been an update pushed to the Ruby_DOLDataSDK Github repo. This should fix the second issue. The "shared secret" has been deprecated and should not be sent; an update will be forthcoming for the sample code. For now just remove that parameter from your sample code file as you have been doing. – Neil Neyman Sep 29 '14 at 19:32
  • My answer was changed to a comment -- I'm going to take another stab at it -- this issue should be fixed completely now. – Neil Neyman Oct 1 '14 at 14:38
2

This issue was caused by both a bug and a missing update in the Ruby SDK. It has been fixed now. You can find the updated Ruby SDK at the Ruby_DOLDataSDK Github repo.

Also, the sample app code you linked has been updated to remove the API_SECRET parameter. The "shared secret" is no longer necessary. So the updated version of the sample program will now work with latest version of the Ruby SDK.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.