0.0
The project is in a healthy, maintained state
A Ruby gem that provides a simple interface for interacting with the SamCart API, focusing on products and orders.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 5.0
~> 13.0
~> 6.0
~> 3.0

Runtime

~> 2.0
~> 2.0
 Project Readme

SamCart API

A Ruby gem for interacting with the SamCart API.

Installation

Add this line to your application's Gemfile:

gem 'samcart_api'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install samcart_api

Usage

Configuration

SamcartApi.configure do |config|
  config.api_key = 'your_api_key'
end

Products

# Find a specific product
product = SamcartApi::Product.find('123')

# Access product attributes
product.id          # => "123"
product.name        # => "Test Product"
product.price       # => "99.99"
product.created_at  # => Time object

Orders

# Find a specific order
order = SamcartApi::Order.find('123')

# Access order attributes
order.id          # => "123"
order.status      # => "completed"
order.total       # => "99.99"
order.created_at  # => Time object

Direct API Access

If you need to make custom API calls, you can use the client directly:

client = SamcartApi::Client.new('your_api_key')

# GET request
response = client.get('/products')

# POST request
response = client.post('/orders', { product_id: '123' })

# PUT request
response = client.put('/products/123', { name: 'Updated Name' })

# DELETE request
response = client.delete('/products/123')

Development

After checking out the repo, run bundle install to install dependencies. Then, run rake spec to run the tests.

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

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b feature/my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin feature/my-new-feature)
  5. Create new Pull Request

License

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