magentor 0.1.2 → 0.1.7
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.
- data/VERSION +1 -1
- data/lib/magento/country.rb +12 -0
- data/lib/magento/customer.rb +4 -1
- data/lib/magento/customer_address.rb +10 -2
- data/lib/magento/region.rb +8 -0
- data/magentor.gemspec +2 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.7
|
data/lib/magento/country.rb
CHANGED
@@ -16,6 +16,18 @@ module Magento
|
|
16
16
|
def all
|
17
17
|
list
|
18
18
|
end
|
19
|
+
|
20
|
+
def find_by_id(id)
|
21
|
+
list.select{ |c| c.id == id }.first
|
22
|
+
end
|
23
|
+
|
24
|
+
def find_by_iso(iso)
|
25
|
+
list.select{ |c| [c.iso2_code, c.iso3_code].include? iso }.first
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def regions
|
30
|
+
Magento::Region.find_by_country(self.iso2_code)
|
19
31
|
end
|
20
32
|
end
|
21
33
|
end
|
data/lib/magento/customer.rb
CHANGED
@@ -30,8 +30,8 @@ module Magento
|
|
30
30
|
#
|
31
31
|
# int customerId - customer ID
|
32
32
|
# array addressData - adress data (country, zip, city, etc...)
|
33
|
-
def create(attributes)
|
34
|
-
id = commit("create", attributes)
|
33
|
+
def create(customer_id, attributes)
|
34
|
+
id = commit("create", customer_id, attributes)
|
35
35
|
record = new(attributes)
|
36
36
|
record.id = id
|
37
37
|
record
|
@@ -83,6 +83,14 @@ module Magento
|
|
83
83
|
end
|
84
84
|
|
85
85
|
end
|
86
|
+
|
87
|
+
def country
|
88
|
+
Magento::Country.find_by_id(self.country)
|
89
|
+
end
|
90
|
+
|
91
|
+
def region
|
92
|
+
Magento::Region.find_by_country_and_id(self.country.iso2, self.region)
|
93
|
+
end
|
86
94
|
|
87
95
|
def delete
|
88
96
|
self.class.delete(self.id)
|
data/lib/magento/region.rb
CHANGED
@@ -20,6 +20,14 @@ module Magento
|
|
20
20
|
def find_by_country(iso)
|
21
21
|
list(iso)
|
22
22
|
end
|
23
|
+
|
24
|
+
def find_by_country_and_id(iso, id)
|
25
|
+
list(iso).select{ |r| r.id == id }.first
|
26
|
+
end
|
27
|
+
|
28
|
+
def find_by_country_iso_and_iso(country_iso, iso)
|
29
|
+
list(country_iso).select{ |r| r.code == iso }.first
|
30
|
+
end
|
23
31
|
end
|
24
32
|
end
|
25
33
|
end
|
data/magentor.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{magentor}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
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"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-10-06}
|
13
13
|
s.email = %q{preston.stuteville@gmail.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"README.rdoc"
|
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:
|
4
|
+
hash: 21
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 7
|
10
|
+
version: 0.1.7
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Preston Stuteville
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-10-06 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|