magentor 0.1.9 → 0.1.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.9
1
+ 0.1.10
data/lib/magento/order.rb CHANGED
@@ -85,7 +85,7 @@ module Magento
85
85
  end
86
86
 
87
87
  def find_by_id(id)
88
- info(list.select { |o| o.id == id }.first.increment_id)
88
+ find(:first, {:order_id => id})
89
89
  end
90
90
 
91
91
  def find_by_increment_id(id)
@@ -97,9 +97,11 @@ module Magento
97
97
  options.each_pair { |k, v| filters[k] = {:eq => v} }
98
98
  results = list(filters)
99
99
  if find_type == :first
100
- results.first
100
+ info(results.first.increment_id)
101
101
  else
102
- results
102
+ results.collect do |o|
103
+ info(o.increment_id)
104
+ end
103
105
  end
104
106
  end
105
107
  end
@@ -1,13 +1,27 @@
1
1
  module Magento
2
2
  class OrderItem < Base
3
3
  class << self
4
- def id
5
- @attributes["item_id"]
4
+ def find_by_id(id)
5
+ Order.list.each do |order|
6
+ Order.info(order.id).order_items.select{ |i| i.id == id }
7
+ end
6
8
  end
7
9
 
8
- def find_by_id(order_id, id)
10
+ def find_by_order_and_id(order_id, id)
9
11
  Order.find_by_id(order_id).order_items.select{ |i| i.id == id }
10
12
  end
11
13
  end
14
+
15
+ def id
16
+ self.item_id
17
+ end
18
+
19
+ def order
20
+ Order.info(self.order_id)
21
+ end
22
+
23
+ def product
24
+ Product.find_by_id_or_sku(self.product_id)
25
+ end
12
26
  end
13
27
  end
data/magentor.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{magentor}
8
- s.version = "0.1.9"
8
+ s.version = "0.1.10"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Preston Stuteville"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: magentor
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 9
10
- version: 0.1.9
9
+ - 10
10
+ version: 0.1.10
11
11
  platform: ruby
12
12
  authors:
13
13
  - Preston Stuteville