activerecord-shipworks 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +35 -0
- data/Rakefile +36 -0
- data/app/models/shipworks/application_record.rb +10 -0
- data/app/models/shipworks/note.rb +6 -0
- data/app/models/shipworks/order.rb +9 -0
- data/app/models/shipworks/order_charge.rb +5 -0
- data/app/models/shipworks/order_item.rb +6 -0
- data/app/models/shipworks/order_item_attribute.rb +5 -0
- data/app/models/shipworks/shipment.rb +5 -0
- data/app/models/shipworks/store.rb +5 -0
- data/app/models/shipworks/user.rb +5 -0
- data/lib/activerecord-shipworks.rb +1 -0
- data/lib/shipworks.rb +4 -0
- data/lib/shipworks/engine.rb +5 -0
- data/lib/shipworks/version.rb +3 -0
- data/lib/tasks/shipworks_tasks.rake +4 -0
- metadata +89 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f51aaea31a510ac343f3d13d7078f3785d3de17041d8175eecd7b9c795120bea
|
4
|
+
data.tar.gz: d2f99b786f96e0810ac1ab8af958c07bcecc2a1caa6b54559cdf2d9e44b95968
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d8400cdec489aa9a8ed91eda611b373f34679644ab16e3242be235d1af246970a32dc8017f925d8f4ad76258b69a28ebb98b682cbbcf7b31ea578b47f0be8709
|
7
|
+
data.tar.gz: 60777236584a793fcf5f8f8a3fd8891f182eb546f007dbe917f00c51caa76049b39a83506e9142b0df171385fd85f3217205e8f45b2c6f8e4f18fc798509e17d
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2018 Dennis Wu
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# ActiveRecord Shipworks
|
2
|
+
This gem allows you to read Shipworks data via ActiveRecord in a isolated namespace `Shipworks`.
|
3
|
+
|
4
|
+
## Installation
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'activerecord-shipworks'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
```bash
|
13
|
+
$ bundle
|
14
|
+
```
|
15
|
+
|
16
|
+
If you are connecting Shipworks as a second database, add Shipworks database configuration to a separate file, e.g. `config/shipworks_database.yml`, and add initializer `config/initializers/shipworks_db.rb` to set the `SHIPWORKS_DB` constant:
|
17
|
+
|
18
|
+
```ruby
|
19
|
+
# config/initializers/shipworks_db.rb
|
20
|
+
SHIPWORKS_DB = YAML.load(ERB.new(IO.read(File.join(Rails.root, "config", "shipworks_database.yml"))).result)[Rails.env.to_s]
|
21
|
+
```
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
You may query Shipworks data as any other ActiveRecord class:
|
25
|
+
```ruby
|
26
|
+
# Last 10 orders
|
27
|
+
Shipworks::Order.order(:OrderDate).last(10)
|
28
|
+
```
|
29
|
+
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/dnswus/activerecord-shipworks.
|
33
|
+
|
34
|
+
## License
|
35
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
begin
|
2
|
+
require 'bundler/setup'
|
3
|
+
rescue LoadError
|
4
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
5
|
+
end
|
6
|
+
|
7
|
+
require 'rdoc/task'
|
8
|
+
|
9
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
10
|
+
rdoc.rdoc_dir = 'rdoc'
|
11
|
+
rdoc.title = 'Shipworks'
|
12
|
+
rdoc.options << '--line-numbers'
|
13
|
+
rdoc.rdoc_files.include('README.md')
|
14
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
15
|
+
end
|
16
|
+
|
17
|
+
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
|
18
|
+
load 'rails/tasks/engine.rake'
|
19
|
+
|
20
|
+
|
21
|
+
load 'rails/tasks/statistics.rake'
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
require 'bundler/gem_tasks'
|
26
|
+
|
27
|
+
require 'rake/testtask'
|
28
|
+
|
29
|
+
Rake::TestTask.new(:test) do |t|
|
30
|
+
t.libs << 'test'
|
31
|
+
t.pattern = 'test/**/*_test.rb'
|
32
|
+
t.verbose = false
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
task default: :test
|
@@ -0,0 +1,9 @@
|
|
1
|
+
module Shipworks
|
2
|
+
class Order < ApplicationRecord
|
3
|
+
belongs_to :store, foreign_key: 'StoreID'
|
4
|
+
has_many :notes, foreign_key: 'ObjectID'
|
5
|
+
has_many :shipments, foreign_key: 'OrderID'
|
6
|
+
has_many :order_items, foreign_key: 'OrderID'
|
7
|
+
has_many :order_charges, foreign_key: 'OrderID'
|
8
|
+
end
|
9
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require "shipworks"
|
data/lib/shipworks.rb
ADDED
metadata
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: activerecord-shipworks
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Dennis Wu
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-03-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 5.1.5
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 5.1.5
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: activerecord-sqlserver-adapter
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ActiveRecord for Shipworks.
|
42
|
+
email:
|
43
|
+
- dennissfwu@gmail.com
|
44
|
+
executables: []
|
45
|
+
extensions: []
|
46
|
+
extra_rdoc_files: []
|
47
|
+
files:
|
48
|
+
- MIT-LICENSE
|
49
|
+
- README.md
|
50
|
+
- Rakefile
|
51
|
+
- app/models/shipworks/application_record.rb
|
52
|
+
- app/models/shipworks/note.rb
|
53
|
+
- app/models/shipworks/order.rb
|
54
|
+
- app/models/shipworks/order_charge.rb
|
55
|
+
- app/models/shipworks/order_item.rb
|
56
|
+
- app/models/shipworks/order_item_attribute.rb
|
57
|
+
- app/models/shipworks/shipment.rb
|
58
|
+
- app/models/shipworks/store.rb
|
59
|
+
- app/models/shipworks/user.rb
|
60
|
+
- lib/activerecord-shipworks.rb
|
61
|
+
- lib/shipworks.rb
|
62
|
+
- lib/shipworks/engine.rb
|
63
|
+
- lib/shipworks/version.rb
|
64
|
+
- lib/tasks/shipworks_tasks.rake
|
65
|
+
homepage: https://github.com/dnswus/activerecord-shipworks
|
66
|
+
licenses:
|
67
|
+
- MIT
|
68
|
+
metadata: {}
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options: []
|
71
|
+
require_paths:
|
72
|
+
- lib
|
73
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - ">="
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
requirements: []
|
84
|
+
rubyforge_project:
|
85
|
+
rubygems_version: 2.7.4
|
86
|
+
signing_key:
|
87
|
+
specification_version: 4
|
88
|
+
summary: ActiveRecord for Shipworks.
|
89
|
+
test_files: []
|