diff --git a/README.md b/README.md index 1985d48..5defcc0 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # AwsPaa -Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/aws_paa`. To experiment with that code, run `bin/console` for an interactive prompt. - -TODO: Delete this and the text above, and describe your gem +`aws_paa` is a slim wrapper around [Amazon's Product Advertising API 5.0](https://webservices.amazon.com/paapi5/documentation/). ## Installation @@ -22,7 +20,17 @@ Or install it yourself as: ## Usage -TODO: Write usage instructions here +```ruby +require 'aws_paa' + +client = AwsPaa::Client.new(access_key: ENV['access_key'], secret_key: ENV['secret_key'], marketplace: :au, partner_tag: ENV['partner_tag']) + +gi = client.get_items(item_ids: '1857231384') + +si = client.search_items(keywords: 'Harry Potter') + +gv = client.get_variations(asin: 'B00422MCUS') +``` ## Development @@ -32,7 +40,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aws_paa. +Bug reports and pull requests are welcome on GitHub at https://github.com/dkam/aws_paa. ## License diff --git a/bin/console b/bin/console index fa20661..19fa407 100755 --- a/bin/console +++ b/bin/console @@ -1,7 +1,7 @@ #!/usr/bin/env ruby require "bundler/setup" -require "aws_paa" +require "paapi" # You can add fixtures and/or initialization code here to make experimenting # with your gem easier. You can also use a different console, if you like. diff --git a/lib/aws_paa.rb b/lib/aws_paa.rb deleted file mode 100644 index 954598c..0000000 --- a/lib/aws_paa.rb +++ /dev/null @@ -1,12 +0,0 @@ -require "aws_paa/version" - -require 'aws_paa/locales' -require 'aws_paa/aws_request' -require 'aws_paa/client' -require 'aws_paa/request' -require 'aws_paa/response' - -module AwsPaa - class Error < StandardError; end - class NotImplemented < StandardError; end -end diff --git a/lib/paapi.rb b/lib/paapi.rb new file mode 100644 index 0000000..5384deb --- /dev/null +++ b/lib/paapi.rb @@ -0,0 +1,12 @@ +require "paapi/version" + +require 'paapi/locales' +require 'paapi/aws_request' +require 'paapi/client' +require 'paapi/request' +require 'paapi/response' + +module Paapi + class Error < StandardError; end + class NotImplemented < StandardError; end +end diff --git a/lib/aws_paa/client.rb b/lib/paapi/client.rb similarity index 98% rename from lib/aws_paa/client.rb rename to lib/paapi/client.rb index 44e4527..1e084d1 100644 --- a/lib/aws_paa/client.rb +++ b/lib/paapi/client.rb @@ -1,6 +1,6 @@ require 'http' -module AwsPaa +module Paapi class Client attr_accessor :marketplace, :partner_tag attr_reader :partner_type, :access_key, :secret_key diff --git a/lib/aws_paa/request.rb b/lib/paapi/request.rb similarity index 98% rename from lib/aws_paa/request.rb rename to lib/paapi/request.rb index dbe42eb..6ec5e05 100644 --- a/lib/aws_paa/request.rb +++ b/lib/paapi/request.rb @@ -1,6 +1,6 @@ require 'byebug' -module AwsPaa +module Paapi class Request include AwsRequest attr_accessor :client, :marketplace, :resources, :payload, :service, :partner_type diff --git a/lib/aws_paa/response.rb b/lib/paapi/response.rb similarity index 93% rename from lib/aws_paa/response.rb rename to lib/paapi/response.rb index 764af45..f41dca2 100644 --- a/lib/aws_paa/response.rb +++ b/lib/paapi/response.rb @@ -1,6 +1,6 @@ require 'json' -module AwsPaa +module Paapi class Response attr_reader :status, :data def initialize(response) diff --git a/lib/aws_paa/version.rb b/lib/paapi/version.rb similarity index 63% rename from lib/aws_paa/version.rb rename to lib/paapi/version.rb index 4a43dee..c516587 100644 --- a/lib/aws_paa/version.rb +++ b/lib/paapi/version.rb @@ -1,3 +1,3 @@ -module AwsPaa +module Paapi VERSION = "0.0.1" end diff --git a/aws_paa.gemspec b/paapi.gemspec similarity index 89% rename from aws_paa.gemspec rename to paapi.gemspec index eaff835..fcf3845 100644 --- a/aws_paa.gemspec +++ b/paapi.gemspec @@ -1,15 +1,15 @@ lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) -require "aws_paa/version" +require "paapi/version" Gem::Specification.new do |spec| - spec.name = "aws_paa" - spec.version = AwsPaa::VERSION + spec.name = "paapi" + spec.version = Paapi::VERSION spec.authors = ["Dan Milne"] spec.email = ["d@nmilne.com"] spec.summary = %q{Client library for Amazon's Product Advertising API v5} - spec.homepage = "https://github.com/dkam/aws_paa" + spec.homepage = "https://github.com/dkam/pappi" spec.license = "MIT" spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'" diff --git a/test/aws_paa_test.rb b/test/paapi_test.rb similarity index 99% rename from test/aws_paa_test.rb rename to test/paapi_test.rb index 415ba49..b17be3c 100644 --- a/test/aws_paa_test.rb +++ b/test/paapi_test.rb @@ -1,8 +1,8 @@ require "test_helper" -class AwsPaaTest < Minitest::Test +class PaapiTest < Minitest::Test def test_that_it_has_a_version_number - refute_nil ::AwsPaa::VERSION + refute_nil ::Paapi::VERSION end def test_it_does_something_useful