{"id":37871044,"url":"https://github.com/deliveroo/ravelin-ruby","last_synced_at":"2026-01-16T16:40:57.261Z","repository":{"id":45051106,"uuid":"52021454","full_name":"deliveroo/ravelin-ruby","owner":"deliveroo","description":"Ravelin Ruby gem - https://www.ravelin.com","archived":false,"fork":false,"pushed_at":"2025-12-12T13:59:51.000Z","size":249,"stargazers_count":9,"open_issues_count":3,"forks_count":5,"subscribers_count":121,"default_branch":"master","last_synced_at":"2025-12-14T02:25:56.028Z","etag":null,"topics":["library","team-trust","trust"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/deliveroo.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2016-02-18T16:29:44.000Z","updated_at":"2025-12-12T13:58:51.000Z","dependencies_parsed_at":"2024-04-10T19:50:24.438Z","dependency_job_id":null,"html_url":"https://github.com/deliveroo/ravelin-ruby","commit_stats":null,"previous_names":[],"tags_count":44,"template":false,"template_full_name":null,"purl":"pkg:github/deliveroo/ravelin-ruby","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deliveroo%2Fravelin-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deliveroo%2Fravelin-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deliveroo%2Fravelin-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deliveroo%2Fravelin-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/deliveroo","download_url":"https://codeload.github.com/deliveroo/ravelin-ruby/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/deliveroo%2Fravelin-ruby/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28480063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["library","team-trust","trust"],"created_at":"2026-01-16T16:40:56.480Z","updated_at":"2026-01-16T16:40:57.232Z","avatar_url":"https://github.com/deliveroo.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ravelin\n\n[![Build Status](https://circleci.com/gh/deliveroo/ravelin-ruby.svg?style=svg)](https://circleci.com/gh/deliveroo/ravelin-ruby)\n\nThe Ravelin gem is a Ruby wrapper for the\n[Ravelin API](https://developer.ravelin.com). Ravelin is a fraud detection\ntool. See https://ravelin.com for more information.\n\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ravelin'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install ravelin\n\n## Usage\n\n\n### Authentication\n\nFirst thing to do is create a client with your Ravelin API key.\n\n```ruby\nclient = Ravelin::Client.new(api_key: 'sk_test_XXX')\n```\n\n### Proxy Client\nAn alternative client can be used to call Ravelin via an HTTP Proxy server that supports basic auth. \n* In order to use the alternative ProxyClient, you must have an HTTP Proxy running. \n* For the purpose of this example, we will use the url: `https://ravelin-proxy.com`.\n* All requests to `https://ravelin-proxy.com/ravelinproxy` must have their basic auth header replaced with the Ravelin token in your HTTP proxy service, then forwarded the entire request to the Ravelin API.\n\nExample of creating the proxy client:\n```ruby\nc = Ravelin::ProxyClient.new(base_url: 'https://ravelin-proxy.com', username:'foo', password:'bar')\n```\n\n### Configuration\n\nThe Ravelin gem uses [Faraday](https://github.com/lostisland/faraday) under the hood. The Faraday adapter and request\ntimeout can be configured with the following:\n\n```ruby\nrequire 'ravelin'\nrequire 'net/http/persistent'\n\nRavelin.faraday_adapter = :net_http_persistent  # default is :net_http\nRavelin.faraday_timeout = 10                    # default is 1 second\n```\n\n\n### Send an event\n\nEvents require an event `name` and `payload` as named arguments. There is also an\noptional `timestamp` argument if your event occurred at a different time. The score\nargument will return a score for that User from Ravelin.\n\n```ruby\nclient.send_event(\n  name: :customer,\n  timestamp: Time.now,\n  score: true,\n  payload: {\n    # ...\n  }\n)\n```\n\n\n#### Event names\n\n* `:customer`\n* `:order`\n* `:payment_method`\n* `:pre_transaction`\n* `:transaction`\n* `:login`\n* `:checkout`\n* `:chargeback`\n* `:voucher`\n* `:voucher_redemption`\n\nInformation about the payload parameters for each event can be found in the\n[Ravelin docs](https://developer.ravelin.com) (ravelins voucher \u0026 voucher_redemption docs not yet released) and by checking out the\n`Ravelin::RavelinObject` classes in the gem\n[source code](https://github.com/deliveroo/ravelin-ruby/tree/master/lib).\n\n*Note:* The payload parameter names should use underscore formatting, not\ncamelcase formatting.\n\n\n#### Event examples\n\n```ruby\n# Send a customer event\n\nclient.send_event(\n  name: :customer,\n  payload: {\n    customer: {\n      customer_id: 'cus_123',\n      given_name:  'Joe',\n      family_name: 'Fraudster',\n      location: {\n        street1:     '123 Street Lane',\n        city:        'London',\n        postal_code: 'SW1A 0AA',\n        country:     'GBR'\n      }\n    }\n  }\n)\n\n# Send an order event\n\nclient.send_event(\n  name: :order,\n  payload: {\n    customer_id: 'cus_123',\n    order: {\n      order_id: 'ord_123',\n      currency: 'GBP',\n      price:    1000,\n      from: {\n        street1:     '123 Street Lane',\n        postal_code: 'SW1A 0AA',\n        country:     'GBR'\n      },\n      to: {\n        street1:     '123 Street Lane',\n        postal_code: 'SW1A 0AA',\n        country:     'GBR'\n      },\n      items: [\n        { sku: 'itm_1', quantity: 1 },\n        { sku: 'itm_2', quantity: 1 }\n      ]\n    }\n  }\n)\n\n# Send a voucher event\n\nclient.send_event(\n  name: :voucher,\n  payload: {\n    voucher_code: 'TEST123',\n    expiry: Time.now + 1,\n    value: 500,\n    currency: 'GBP',\n    creation_time: Time.now,\n    voucher_type: 'REFERRAL',\n    referrer_id: '1',\n    referral_value: 500\n  }\n)\n\n# Send a voucher redemption event\n\nclient.send_event(\n  name: :'paymentmethod/voucher',\n  payload: {\n    customer_id: 123983,\n    voucher_redemption: {\n      payment_method_id: 'voucher:12345',\n      voucher_code: 'FOOBAR9835',\n      referrer_id: '1',\n      expiry: Time.now + 1,\n      value: 500,\n      currency: 'GBP,\n      voucher_type: 'REFERRAL',\n      redemption_time: Time.now - 1,\n      success: false,\n      failure_source: :CLIENT, \n      failure_reason: :EXPIRED\n    }\n  }\n)\n\nclient.send_event(\n  name: :'paymentmethod/voucher',\n  payload: {\n    customer_id: 123983,\n    voucher_redemption: {\n      payment_method_id: 'voucher:12345',\n      voucher_code: 'FOOBAR9835',\n      referrer_id: '1',\n      expiry: Time.now + 1,\n      value: 500,\n      currency: 'GBP,\n      voucher_type: 'REFERRAL',\n      redemption_time: Time.now - 1,\n      success: true,\n    }\n  }\n)\n\n```\n\n### Send a backfill event\n\nBackfill events are designed to be used to populate Ravelin with historical\ndata. The Ravelin backfill event API is identical to the regular event API,\nother than that the backfill event API is not subject to the standard rate\nlimits.\n\nSee https://developer.ravelin.com/#backfill for more information.\n\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run\n`rake spec` to run the tests. You can also run `bin/console` for an interactive\nprompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To\nrelease a new version, update the version number in `version.rb`, and then run\n`bundle exec rake release`, which will create a git tag for the version, push\ngit commits and tags, and push the `.gem` file to\n[rubygems.org](https://rubygems.org).\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at\nhttps://github.com/deliveroo/ravelin-ruby. This project is intended to be a safe,\nwelcoming space for collaboration, and contributors are expected to adhere to\nthe [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n\n## License\n\nThe gem is available as open source under the terms of the\n[MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeliveroo%2Fravelin-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdeliveroo%2Fravelin-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdeliveroo%2Fravelin-ruby/lists"}