{"id":15563065,"url":"https://github.com/dkam/rakuten_product_api","last_synced_at":"2025-03-29T05:13:03.529Z","repository":{"id":42126445,"uuid":"338810337","full_name":"dkam/rakuten_product_api","owner":"dkam","description":null,"archived":false,"fork":false,"pushed_at":"2022-06-09T04:39:59.000Z","size":64,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-07T09:47:41.318Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/dkam.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-02-14T13:22:00.000Z","updated_at":"2021-10-04T23:07:46.000Z","dependencies_parsed_at":"2022-08-12T07:20:28.726Z","dependency_job_id":null,"html_url":"https://github.com/dkam/rakuten_product_api","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkam%2Frakuten_product_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkam%2Frakuten_product_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkam%2Frakuten_product_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dkam%2Frakuten_product_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dkam","download_url":"https://codeload.github.com/dkam/rakuten_product_api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246140592,"owners_count":20729802,"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":[],"created_at":"2024-10-02T16:17:17.786Z","updated_at":"2025-03-29T05:13:03.506Z","avatar_url":"https://github.com/dkam.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RakutenProductApi\n\nTo experiment with this library, run `bin/console` for an interactive prompt.\n\n## API Documentation\n\nThe Rakuten Product API documentation can be found at the following links.\n- [Tryout Guide](https://developers.rakutenadvertising.com/guides/try_out_apis)\n- [Product Search](https://developers.rakutenadvertising.com/guides/product_search)\n- [API Keys](https://developers.rakutenadvertising.com/default/dashboard/applications/)\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rakuten_product_api'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install rakuten_product_api\n\n## Usage\n\nThe library comes with `bin/console` which can be used to explore the client and api.  If there is a local `./config.rb` the console script will load it.\n\nTo configured the library for Rails, create an initializer file `config/initializers/rakuten.rb`\n\n```ruby\nRakutenProductApi.configure do |config|\n  config.sid             = 'your-site-id'\n  config.client_id       = 'your-client-id'\n  config.client_secret   = 'your-client-secret'\nend\n```\n\nOnce you have configured the library, you can create a client.\n\n```ruby\nclient = RakutenProductApi::Client.new\n\nclient.sid\n=\u003e \"your-site-id\"\n```\n\nThis client should be threadsafe.  Configuration values are local to your instance.\n\n### Authentication\nThis library needs to query the API to retreive an `access_token` which has an `access_token_expires_at` time, prior to which, the library will refresh the token\n\nYou can initialise the library with the `access_token` and `access_token_expires_at` values to avoid this lookup. If the `access_token_expires_at` is nil or in the past, the library will fetch the value so you can safely cache this value and use it without checking it's expiry.\n\n```ruby\nclient = RakutenProductApi::Client.new(access_token: 'abcd1234', access_token_expires_at: 1613362973)\n\nclient.endpoint\n=\u003e \"https://api.linksynergy.com\"\n\nclient.access_token\n=\u003e \"abcd1234\"\n````\n\n## Querying\n### Search for keywords:\n\nYou can specify which merchants to query by using mid paramater.  For example Kobo Australia would be: `mid: 38131`\n\n```ruby\nresults = client.search(keyword: 'Murderbot', mid: 38131)\nresults.items.count\n=\u003e 7\n\nresults.items[0].merchant\n=\u003e \"Rakuten Kobo Australia\"\n\nresults.items[0].isbn\n=\u003e \"9781250185464\"\n\nresults.items[0].title\n=\u003e \"Exit Strategy\"\n\nresults.items[0].price\n=\u003e [\"15.06\", \"AUD\"]\n\nresults.items[0].rrp\n=\u003e [\"18.70\", \"AUD\"]\n```\n\n### Search for ISBNs:\n\nYou can specify which merchants to query by using `mid: 38131`\n\n```ruby\nresults = client.search(keyword: '9781501977824', mid: 38131)\nresults.items[0].gtin\n=\u003e \"9781501977824\"\nresults.items[0].title\n=\u003e \"All Systems Red\"\n```\n\nThe API also allows other attribute:\n\n* exact\n* one\n* none\n* sort \u0026 sorttype\n\nWhen using sort, you must also use sorttype ( 'asc' or 'dsc').  See the documentation for more.\n\n## TODO\n\nThis library implement the parts I need. For example, it doesn't handle paging through results as I don't need it, but I'm happy to accept pull request.\n\n## Notes\n\n* ISBN is taken from either the `sku` or the `keywords` fields and mached against a regular expression `/97[98]\\d{10}/` as there's no specific field for it.\n* Condition is guessed by looking for the string \"Used\" in the description.  This is a terrible idea, but there is no field for condition.\n* This library aliases rrp -\u003e price and price -\u003e saleprice.  When sorting you need to use the original attribute names ( price / saleprice )\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nIf you create a file `config.rb`, it will be loaded by `bin/console`, allowing you to configure it automatically.\n\n```ruby\nRakutenProductApi.configure do |config|\n  config.sid             = 'your-site-id'\n  config.username        = 'your-rakuten-username'\n  config.password        = 'your-rakuten-password'\n  config.consumer_key    = 'your-consumer-key'\n  config.consumer_secret = 'your-consumer-secret'\nend\n```\n\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/dkam/rakuten_product_api.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkam%2Frakuten_product_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdkam%2Frakuten_product_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdkam%2Frakuten_product_api/lists"}