magerecord 0.2.2 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3062ce7e369bc26a914edb1c373b79e98a14bb5f
4
- data.tar.gz: 609e55ad94b3a7a13214b3aa0db28613753d4179
3
+ metadata.gz: 2a455d80781a0895523d0778b04910c2c3160fac
4
+ data.tar.gz: 717908a56b7cd6123a7c7e25ae01b688314e8aa4
5
5
  SHA512:
6
- metadata.gz: cb08aedba0156d41985c2693822daf587804de020fbd7f748222b37c7b83099bf880658f525a008d2a06023a50922539511407120d2efc6c63b96f11ec691870
7
- data.tar.gz: 5c9712e55b8c6ce1df5742988b19c82a7f86b68050d208fbd5eb19b350713e0933aebe5e493d6baf75f90915cc6eeed244fb61571d9ce194aad0ad294836c570
6
+ metadata.gz: 7c83748592840304a93494584ae6cc776a5440ecde805e039ee2874479a7d8efbc4be5dfd58d941d65217b2f1e5566e609938e18956ce119722368f8021c1bec
7
+ data.tar.gz: 05fe20b8001888179361dd8fac98636bb204714f9d1f5abd8217f868b9ffccb3969c0260223d8a7c24126acf750afee3944cfc61e1d8b13d29bc6f4044d92ed7
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  GEM
2
2
  remote: https://rubygems.org/
3
3
  specs:
4
- activemodel (4.2.1)
5
- activesupport (= 4.2.1)
4
+ activemodel (4.2.3)
5
+ activesupport (= 4.2.3)
6
6
  builder (~> 3.1)
7
- activerecord (4.2.1)
8
- activemodel (= 4.2.1)
9
- activesupport (= 4.2.1)
7
+ activerecord (4.2.3)
8
+ activemodel (= 4.2.3)
9
+ activesupport (= 4.2.3)
10
10
  arel (~> 6.0)
11
- activesupport (4.2.1)
11
+ activesupport (4.2.3)
12
12
  i18n (~> 0.7)
13
13
  json (~> 1.7, >= 1.7.7)
14
14
  minitest (~> 5.1)
15
15
  thread_safe (~> 0.3, >= 0.3.4)
16
16
  tzinfo (~> 1.1)
17
- addressable (2.3.7)
18
- arel (6.0.0)
17
+ addressable (2.3.8)
18
+ arel (6.0.2)
19
19
  builder (3.2.2)
20
20
  descendants_tracker (0.0.4)
21
21
  thread_safe (~> 0.3, >= 0.3.1)
@@ -31,8 +31,8 @@ GEM
31
31
  multi_json (>= 1.7.5, < 2.0)
32
32
  nokogiri (~> 1.6.3)
33
33
  oauth2
34
- hashie (3.4.0)
35
- highline (1.7.1)
34
+ hashie (3.4.2)
35
+ highline (1.7.2)
36
36
  i18n (0.7.0)
37
37
  jeweler (2.0.1)
38
38
  builder
@@ -43,12 +43,12 @@ GEM
43
43
  nokogiri (>= 1.5.10)
44
44
  rake
45
45
  rdoc
46
- json (1.8.2)
47
- json (1.8.2-java)
48
- jwt (1.4.1)
46
+ json (1.8.3)
47
+ json (1.8.3-java)
48
+ jwt (1.5.1)
49
49
  mini_portile (0.6.2)
50
- minitest (5.5.1)
51
- multi_json (1.11.0)
50
+ minitest (5.7.0)
51
+ multi_json (1.11.2)
52
52
  multi_xml (0.5.5)
53
53
  multipart-post (2.0.0)
54
54
  mysql2 (0.3.18)
@@ -61,7 +61,7 @@ GEM
61
61
  multi_json (~> 1.3)
62
62
  multi_xml (~> 0.5)
63
63
  rack (~> 1.2)
64
- rack (1.6.0)
64
+ rack (1.6.4)
65
65
  rake (10.4.2)
66
66
  rdoc (3.12.2)
67
67
  json (~> 1.4)
@@ -71,11 +71,11 @@ GEM
71
71
  shoulda-context (1.2.1)
72
72
  shoulda-matchers (2.8.0)
73
73
  activesupport (>= 3.0.0)
74
- simplecov (0.9.2)
74
+ simplecov (0.10.0)
75
75
  docile (~> 1.1.0)
76
- multi_json (~> 1.0)
77
- simplecov-html (~> 0.9.0)
78
- simplecov-html (0.9.0)
76
+ json (~> 1.8)
77
+ simplecov-html (~> 0.10.0)
78
+ simplecov-html (0.10.0)
79
79
  thread_safe (0.3.5)
80
80
  thread_safe (0.3.5-java)
81
81
  tzinfo (1.2.2)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.2
1
+ 0.3.0
@@ -0,0 +1,33 @@
1
+ module MageRecord
2
+ # invoice items can be parents / children of other invoice items
3
+ # (only within the same order)
4
+ class InvoiceItem < ActiveRecord::Base
5
+ self.table_name = :sales_flat_invoice_item
6
+ self.primary_key = :entity_id
7
+
8
+ belongs_to :order_item, class_name: :OrderItem
9
+ belongs_to :parent, class_name: :InvoiceItem, foreign_key: :parent_item_id
10
+ belongs_to :product
11
+
12
+ # note: add an index on the column "parent_item_id" to
13
+ # *dramatically* speed up loading of child order items from the parent order item
14
+ has_many :children, class_name: :InvoiceItem, foreign_key: :parent_item_id
15
+
16
+
17
+ # call associated product's method
18
+ def method_missing(meth, *args, &block)
19
+ if product && product.respond_to?(meth)
20
+ product.send(meth)
21
+ else
22
+ # call superclass's method_missing method
23
+ # or risk breaking Ruby's method lookup
24
+ super
25
+ end
26
+ end
27
+
28
+
29
+ def respond_to?(meth, include_private = false)
30
+ super || (product && product.respond_to?(meth))
31
+ end
32
+ end
33
+ end
@@ -12,6 +12,8 @@ module MageRecord
12
12
  # *dramatically* speed up loading of child order items from the parent order item
13
13
  has_many :children, class_name: :OrderItem, foreign_key: :parent_item_id
14
14
 
15
+ has_one :invoice_item, class_name: :InvoiceItem
16
+
15
17
 
16
18
  # call associated product's method
17
19
  def method_missing(meth, *args, &block)
data/magerecord.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: magerecord 0.2.2 ruby lib
5
+ # stub: magerecord 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "magerecord"
9
- s.version = "0.2.2"
9
+ s.version = "0.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Marc"]
14
- s.date = "2015-03-23"
14
+ s.date = "2015-07-29"
15
15
  s.description = "A simple ActiveRecord wrapper for various Magento models"
16
16
  s.email = "xerokill@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/magerecord/eav_record.rb",
34
34
  "lib/magerecord/fitlion/order.rb",
35
35
  "lib/magerecord/fitlion/product.rb",
36
+ "lib/magerecord/invoice_item.rb",
36
37
  "lib/magerecord/order.rb",
37
38
  "lib/magerecord/order_address.rb",
38
39
  "lib/magerecord/order_item.rb",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Marc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-23 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activerecord
@@ -130,6 +130,7 @@ files:
130
130
  - lib/magerecord/eav_record.rb
131
131
  - lib/magerecord/fitlion/order.rb
132
132
  - lib/magerecord/fitlion/product.rb
133
+ - lib/magerecord/invoice_item.rb
133
134
  - lib/magerecord/order.rb
134
135
  - lib/magerecord/order_address.rb
135
136
  - lib/magerecord/order_item.rb