
Security News
Follow-up and Clarification on Recent Malicious Ruby Gems Campaign
A clarification on our recent research investigating 60 malicious Ruby gems.
Ruby client for Sema Media Data's image OCR API. Used for getting an estimated text to image ratio for validating images before being submitted to Facebook Ads.
Add this line to your application's Gemfile:
gem 'sema_api_ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install sema_api_ruby
Configure the client by providing an API token. Also tweak the configuration for any of the OCR settings.
SemaApiRuby.configure do |config|
config.access_token = 'myaccesstokenhere'
#optional - below are the defaults
config.ocr_settings = {
lang: 'en', # english language
outform: 'json', # output as json
sp: 'True', # perform spellcheck
mh: 'True', # multi-hypothesis... increases accuracy at slight performance cost
df: 'True', # dictionary based word filtering
noempty: 'True' # only return detected objects that are not empty
}
end
Post a request to the ocr endpoint with the path to an image to get back a raw response from the api (post made using Faraday gem)
client = SemaApiRuby.new
file_path = '/path/to/your/image.jpg'
client.post_ocr_image(file_path)
# => #<Faraday::Response:0x007fcb641591e0 ...
Use this method to both post to the ocr endpoint and return an text to image ratio
client = SemaApiRuby.new
file_path = '/path/to/your/image.jpg'
client.text_to_image_ratio(file_path)
# => 0.2123
Copy the sample dotenv file to .env
$> cp .env.sample .env
Update it with a testing API token if you want to run specs against the live API rather than against the network stubs
Run the specs
$> bundle exec rspec spec
This gem uses a testing gem called VCR to record and replay HTTP requests. If the actual API has changed you will need to delete all "casettes" located in spec/cassettes/
so that requests will run against the live API
git checkout -b my-new-feature
)git commit -am 'Add some feature'
)git push origin my-new-feature
)FAQs
Unknown package
We found that sema_api_ruby demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.
Research
/Security News
A malicious Go module posing as an SSH brute forcer exfiltrates stolen credentials to a Telegram bot controlled by a Russian-speaking threat actor.