https://github.com/dnswus/activerecord-shipworks
Access Shipworks data via ActiveRecord
https://github.com/dnswus/activerecord-shipworks
activerecord ruby ruby-on-rails shipworks
Last synced: 2 months ago
JSON representation
Access Shipworks data via ActiveRecord
- Host: GitHub
- URL: https://github.com/dnswus/activerecord-shipworks
- Owner: dnswus
- License: mit
- Created: 2018-03-15T23:58:11.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-26T20:37:10.000Z (almost 8 years ago)
- Last Synced: 2025-03-18T18:35:26.195Z (over 1 year ago)
- Topics: activerecord, ruby, ruby-on-rails, shipworks
- Language: Ruby
- Size: 35.2 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# ActiveRecord Shipworks
This gem allows you to read Shipworks data via ActiveRecord in a isolated namespace `Shipworks`.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'activerecord-shipworks'
```
And then execute:
```bash
$ bundle
```
ActiveRecord Shipworks uses the main database connection by default. However, in most of the cases, you want to connect to Shipworks as a second database connection. You could do that by setting `ENV['SHIPWORKS_DATABASE_URL]` by using a configuration file called `config/shipworks_database.yml`.
## Usage
You may query Shipworks data as any other ActiveRecord class:
```ruby
# Last 10 orders
Shipworks::Order.order(:OrderDate).last(10)
```
## Available Models
* Order
* OrderItem
* OrderItemAttribute
* OrderCharge
* Note
* Shipment
* Store
* UpsPackage
* User
### ER Diagram
```
+---------+ +---------------+ +-------------------+
| | | | | |
| Store | | AmazonOrder | | AmazonOrderItem |
| | | | | |
+-------+-+ +-+-------------+ +---+---------------+
| | |
| | |
| | |
/|\ | |
+---------------+ +--+-----+--+ +---------+---+ +----------------------+
| |\ | | /| | /| |
| OrderCharge +---------+ Order +-------+ OrderItem +------+ OrderItemAttribute |
| |/ | | \| | \| |
+---------------+ +-+-------+-+ +-------------+ +----------------------+
| |
| |
| |
/|\ /|\
+--------+ +------+-+ +-+----------+ +--------------+
| | /| | | | /| |
| User +-------+ Note | | Shipment +---------+ UpsPackage |
| | \| | | | \| |
+--------+ +--------+ +------------+ +--------------+
```
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/dnswus/activerecord-shipworks.
## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).