Skip to content

promohunt/promostandards-client

Repository files navigation

promostandards-client

A Ruby client to access PromoStandards data from suppliers.

Currently, only interfaces some of the Product Data and the Media Content services.

TO DO

  • Add tests
  • Return nil when primary image is not available
  • Provide interfaces to other services as well

Installation

Add this line to your application's Gemfile:

gem 'promostandards-client',  git: 'https://github.com/promohunt/promostandards-client'

And then execute:

$ bundle

Usage

require 'promostandards/client.rb'

client = PromoStandards::Client.new(
  access_id: 'YOUR ID'
  password: 'YOUR PASSWORD'
  product_data_service_url: 'https://services.starline.com/CustomerProductDataService/CustomerProductDataService.svc'
  media_content_service_url: 'https://services.starline.com/MediaContentService/MediaContentService.svc'
  product_pricing_and_configuration_service_url: 'https://services.starline.com/ppc/PricingAndConfiguration.svc'
)

# Get sellable product ids
product_ids = client.get_sellable_product_ids

# Get product data
product_hash = client.get_product_data('product_id')

# Get primary product image
primary_image = client.get_primary_image('product_id')

Testing PromoStandards end points

  • Add credentials and service URLs to a ps_configs.yml (See ps_configs.yml.example)
  • Run bundle exec ruby test_ps_services.rb

This would use the data in the YAML file, make sample requests to all the supplier services and log outcomes. This is useful to test out the services end to end.

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/promohunt/promostandards-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the promostandards-client project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

About PromoHunt

PromoHunt Logo

promostandards-client is maintained and funded by PromoHunt, inc. The names and logos for PromoHunt are trademarks of PromoHunt, inc.

PromoHunt is a browser extension that helps promotional products distributors & suppliers save time and money.