{"id":13484224,"url":"https://github.com/apache/predictionio-sdk-ruby","last_synced_at":"2025-03-27T16:30:34.722Z","repository":{"id":6712952,"uuid":"7958616","full_name":"apache/predictionio-sdk-ruby","owner":"apache","description":"PredictionIO Ruby SDK","archived":true,"fork":false,"pushed_at":"2018-09-20T18:41:33.000Z","size":106,"stargazers_count":191,"open_issues_count":5,"forks_count":39,"subscribers_count":28,"default_branch":"develop","last_synced_at":"2025-03-26T21:19:11.565Z","etag":null,"topics":["big-data","predictionio","scala"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/apache.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-02-01T13:29:10.000Z","updated_at":"2023-07-25T13:47:23.000Z","dependencies_parsed_at":"2022-08-20T16:00:44.393Z","dependency_job_id":null,"html_url":"https://github.com/apache/predictionio-sdk-ruby","commit_stats":null,"previous_names":["apache/incubator-predictionio-sdk-ruby","predictionio/predictionio-ruby-sdk"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fpredictionio-sdk-ruby","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fpredictionio-sdk-ruby/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fpredictionio-sdk-ruby/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/apache%2Fpredictionio-sdk-ruby/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/apache","download_url":"https://codeload.github.com/apache/predictionio-sdk-ruby/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245882191,"owners_count":20687844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["big-data","predictionio","scala"],"created_at":"2024-07-31T17:01:20.947Z","updated_at":"2025-03-27T16:30:34.388Z","avatar_url":"https://github.com/apache.png","language":"Ruby","readme":"\u003c!--\nLicensed to the Apache Software Foundation (ASF) under one or more\ncontributor license agreements.  See the NOTICE file distributed with\nthis work for additional information regarding copyright ownership.\nThe ASF licenses this file to You under the Apache License, Version 2.0\n(the \"License\"); you may not use this file except in compliance with\nthe License.  You may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n--\u003e\n\n# Apache PredictionIO Ruby SDK\n\n[![Build Status](https://api.travis-ci.org/apache/predictionio-sdk-ruby.svg?branch=develop)](https://github.com/apache/predictionio-sdk-ruby)\n[![Gem Version](https://badge.fury.io/rb/predictionio.svg)](http://badge.fury.io/rb/predictionio)\n\nThe Ruby SDK provides a convenient wrapper for PredictionIO Event Server API and\nEngine API. It allows you to quickly record your users' behavior and retrieve\npersonalized predictions for them.\n\n## Documentation\n\nFull Ruby SDK documentation can be found [here](http://www.rubydoc.info/github/apache/incubator-predictionio-sdk-ruby).\n\nPlease see the [PredictionIO App Integration\nOverview](http://predictionio.apache.org/appintegration/) to\nunderstand how the SDK can be used to integrate PredictionIO Event Server and\nEngine with your application.\n\n## Installation\n\nRuby 2+ required!\n\nThe module is published to [RubyGems](http://rubygems.org/gems/predictionio) and\ncan be installed directly by:\n\n```sh\ngem install predictionio\n```\n\nOr using [Bundler](http://bundler.io/) with:\n\n```\ngem 'predictionio', '0.12.1'\n```\n\n## Sending Events to Event Server\n\nPlease refer to [Event Server\ndocumentation](http://predictionio.apache.org/datacollection/) for\nevent format and how the data can be collected from your app.\n\n### Instantiate Event Client and connect to PredictionIO Event Server\n\n```ruby\nrequire 'predictionio'\n\n# Define environment variables.\nENV['PIO_THREADS'] = '50' # For async requests.\nENV['PIO_EVENT_SERVER_URL'] = 'http://localhost:7070'\nENV['PIO_ACCESS_KEY'] = 'YOUR_ACCESS_KEY' # Find your access key with: `$ pio app list`.\n\n# Create PredictionIO event client.\nclient = PredictionIO::EventClient.new(ENV['PIO_ACCESS_KEY'], ENV['PIO_EVENT_SERVER_URL'], Integer(ENV['PIO_THREADS']))\n```\n\n### Create a `$set` user event and send it to Event Server\n\n```ruby\nclient.create_event(\n  '$set',\n  'user',\n  user_id\n)\n\n```\n\n### Create a `$set` item event and send it to Event Server\n\n```ruby\nclient.create_event(\n  '$set',\n  'item',\n  item_id,\n  { 'properties' =\u003e { 'categories' =\u003e ['Category 1', 'Category 2'] } }\n)\n```\n\n### Create a `$set` item event and send it to Event Server to specific channel\n\n*NOTE:* channels are supported in PIO version \u003e= 0.9.2 only. Channel must be created first.\n\n```ruby\nclient.create_event(\n  '$set',\n  'item',\n  item_id,\n  { 'properties' =\u003e { 'categories' =\u003e ['Category 1', 'Category 2'], 'channel' =\u003e 'test-channel'} }\n)\n```\n\n### Create a user 'rate' item event and send it to Event Server\n\n```ruby\nclient.create_event(\n  'rate',\n  'user',\n  user_id, {\n    'targetEntityType' =\u003e 'item',\n    'targetEntityId' =\u003e item_id,\n    'properties' =\u003e { 'rating' =\u003e 10 }\n  }\n)\n```\n\n### Asynchronous request\n\nTo send an async request, simply use the `acreate_event` method instead of\n`create_event`. Be aware that the asynchronous method does not throw errors.\nIt's best to use the synchronous method when first getting started.\n\n## Query PredictionIO Engine\n\n### Connect to the Engine:\n\n```ruby\n# Define environmental variables.\nENV['PIO_ENGINE_URL'] = 'http://localhost:8000'\n\n# Create PredictionIO engine client.\nclient = PredictionIO::EngineClient.new(ENV['PIO_ENGINE_URL'])\n```\n\n### Send a prediction query to the engine and get the predicted result:\n\n```ruby\n# Get 5 recommendations for items similar to 10, 20, 30.\nresponse = client.send_query(items: [10, 20, 30], num: 5)\n```\n\n## Mailing List\n\nPlease use the Apache mailing lists. Subscription instructions are\n[here](http://predictionio.apache.org/support/).\n\n## Issue Tracker\n\nUse [the Apache JIRA](https://issues.apache.org/jira/browse/PIO), and file any\nissues under the `Ruby SDK` component.\n\n## Contributing\n\nPlease follow these\n[instructions](http://predictionio.apache.org/community/contribute-code/).\n\n## License\n\n[Apache License 2.0](http://www.apache.org/licenses/LICENSE-2.0).\n","funding_links":[],"categories":["Machine Learning"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fpredictionio-sdk-ruby","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapache%2Fpredictionio-sdk-ruby","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapache%2Fpredictionio-sdk-ruby/lists"}