{"id":13463426,"url":"https://github.com/jugend/amazon-ecs","last_synced_at":"2025-03-25T06:31:58.623Z","repository":{"id":487580,"uuid":"113662","full_name":"jugend/amazon-ecs","owner":"jugend","description":"Amazon Product Advertising Ruby API","archived":false,"fork":false,"pushed_at":"2020-10-01T02:36:43.000Z","size":241,"stargazers_count":552,"open_issues_count":6,"forks_count":94,"subscribers_count":19,"default_branch":"master","last_synced_at":"2025-03-21T02:36:10.652Z","etag":null,"topics":[],"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/jugend.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG","contributing":null,"funding":null,"license":"MIT-LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-01-24T03:56:38.000Z","updated_at":"2025-02-08T09:12:00.000Z","dependencies_parsed_at":"2022-07-20T15:18:09.930Z","dependency_job_id":null,"html_url":"https://github.com/jugend/amazon-ecs","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jugend%2Famazon-ecs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jugend%2Famazon-ecs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jugend%2Famazon-ecs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jugend%2Famazon-ecs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jugend","download_url":"https://codeload.github.com/jugend/amazon-ecs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245414334,"owners_count":20611357,"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-07-31T13:00:53.246Z","updated_at":"2025-03-25T06:31:58.285Z","avatar_url":"https://github.com/jugend.png","language":"Ruby","funding_links":[],"categories":["Web Apps, Services \u0026 Interaction","Ruby"],"sub_categories":["API Clients"],"readme":"# amazon-ecs\n\n`amazon-ecs` is a generic Ruby wrapper to access Amazon Product Advertising API.\n\nThe library wraps around [Nokogiri](http://www.nokogiri.org/) element object. It provides an easy access to the XML response elements and attributes.\n\nThe gist is, if the API and the response schema are updated, `amazon-ecs` library will still work,\nand you only need to update the xml paths.\n\n## Installation\n\n```shell\ngem install amazon-ecs\n```\n\n## Usage\n\n```ruby\nrequire 'amazon/ecs'\n\n# Default options:\n#  options[:version] =\u003e \"2013-08-01\"\n#  options[:service] =\u003e \"AWSECommerceService\"\nAmazon::Ecs.configure do |options|\n  options[:AWS_access_key_id] = '[your access key]'\n  options[:AWS_secret_key] = '[you secret key]'\n  options[:associate_tag] = '[your associate tag]'\nend\n\n# To replace default options\n# Amazon::Ecs.options = { ... }\n\n# To override default options\nres = Amazon::Ecs.item_search('ruby', {:response_group =\u003e 'Medium', :sort =\u003e 'salesrank'})\n\n# Search Amazon UK\nres = Amazon::Ecs.item_search('ruby', :country =\u003e 'uk')\n\n# Search all items, default search index: Books\nres = Amazon::Ecs.item_search('ruby', :search_index =\u003e 'All')\n\nres.is_valid_request?\nres.has_error?\nres.error                                 # error message\nres.total_pages\nres.total_results\nres.item_page                             # current page no if :item_page option is provided\n\n# Find elements matching 'Item' in response object\nres.items.each do |item|\n  # Retrieve string value using XML path\n  item.get('ASIN')\n  item.get('ItemAttributes/Title')\n\n  # Return Amazon::Element instance\n  item_attributes = item.get_element('ItemAttributes')\n  item_attributes.get('Title')\n\n  item_attributes.get_unescaped('Title') # unescape HTML entities\n  item_attributes.get_array('Author')    # ['Author 1', 'Author 2', ...]\n  item_attributes.get('Author')          # 'Author 1'\n\n  # Return a hash object with the element names as the keys\n  item.get_hash('SmallImage') # {:url =\u003e ..., :width =\u003e ..., :height =\u003e ...}\n\n  # Return the first matching path\n  item_height = item.get_element('ItemDimensions/Height')\n  item_height.attributes['Units']        # 'hundredths-inches'\n\n  # There are two ways to find elements:\n  # 1) return an array of Amazon::Element\n  reviews = item.get_elements('EditorialReview')\n  reviews.each do |review|\n    el.get('Content')\n  end\n\n  # 2) return Nokogiri::XML::NodeSet object or nil if not found\n  reviews = item/'EditorialReview'\n  reviews.each do |review|\n    el = Amazon::Element.new(review)\n    el.get('Content')\n  end\nend\n```\n\n## Other Operations\n\n```ruby\n# Item lookup\nres = Amazon::Ecs.item_lookup(\"0974514055\")\nitem = res.get_element(\"Item\")\n\n# Browse node lookup\nres = Amazon::Ecs.browse_node_lookup(\"17\")\nnodes = res.get_elements(\"BrowseNode\")\nnodes.each do |node|\n  node.get('Name')\nend\n\n# Similarity lookup\nAmazon::ECS.similarity_lookup(\"0974514055\")\n\n# Other operation\nAmazon::Ecs.send_request(:operation =\u003e '[OperationName]', :id =\u003e 123)\n```\n\nRefer to [Amazon Product Advertising API](https://affiliate-program.amazon.com/gp/advertising/api/detail/main.html)\ndocumentation for more information on the operations and request parameters supported.\n\n## Dump and Load\n\n```ruby\nres.marshal_dump         # xml string\nres.marshal_load(xml)\n```\n\n## Debug\n\nTurn on the debug mode to display API request params, full URL and XML response:\n\n```ruby\nAmazon::Ecs::debug = true\n```\nOr you could also set the `DEBUG_AMAZON_ECS` environment variable to 1.\n\n```sh\nDEBUG_AMAZON_ECS=1 [command]\n```\n\n## License\n\n[The MIT License]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjugend%2Famazon-ecs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjugend%2Famazon-ecs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjugend%2Famazon-ecs/lists"}