handcrafted-a2ws 0.1.4 → 0.1.5
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.yml +1 -1
- data/a2ws.gemspec +2 -1
- data/lib/a2ws/image.rb +3 -7
- data/lib/a2ws/item.rb +8 -18
- data/lib/a2ws/methodize.rb +11 -0
- metadata +2 -1
data/VERSION.yml
CHANGED
data/a2ws.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{a2ws}
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.5"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Andy Shen", "Josh Owens"]
|
@@ -26,6 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
"lib/a2ws/image_search.rb",
|
27
27
|
"lib/a2ws/item.rb",
|
28
28
|
"lib/a2ws/item_search.rb",
|
29
|
+
"lib/a2ws/methodize.rb",
|
29
30
|
"spec/a2ws_spec.rb",
|
30
31
|
"spec/spec_helper.rb"
|
31
32
|
]
|
data/lib/a2ws/image.rb
CHANGED
@@ -2,15 +2,11 @@ module A2WS
|
|
2
2
|
|
3
3
|
|
4
4
|
class Image
|
5
|
-
attr_accessor :size, :
|
5
|
+
attr_accessor :size, :data_hash
|
6
|
+
include Methodize
|
6
7
|
|
7
8
|
def initialize(size, data)
|
8
|
-
@size, @
|
9
|
-
end
|
10
|
-
|
11
|
-
|
12
|
-
def method_missing(meth,*args)
|
13
|
-
@data[meth.to_s]
|
9
|
+
@size, @data_hash = size, data
|
14
10
|
end
|
15
11
|
|
16
12
|
end
|
data/lib/a2ws/item.rb
CHANGED
@@ -2,39 +2,29 @@ module A2WS
|
|
2
2
|
|
3
3
|
|
4
4
|
class Item
|
5
|
-
attr_accessor :
|
5
|
+
attr_accessor :data_hash
|
6
|
+
include Methodize
|
6
7
|
|
7
8
|
def initialize(item)
|
8
|
-
@
|
9
|
+
@data_hash = item
|
9
10
|
end
|
10
11
|
|
11
12
|
def item_attributes
|
12
|
-
ItemAttributes.new @
|
13
|
+
ItemAttributes.new @data_hash["item_attributes"]
|
13
14
|
end
|
14
15
|
|
15
16
|
def images
|
16
|
-
ImageSearch.new(@
|
17
|
-
end
|
18
|
-
|
19
|
-
def method_missing(meth,*args)
|
20
|
-
if @item_hash.keys.include?(meth.to_s)
|
21
|
-
@item_hash[meth.to_s]
|
22
|
-
else
|
23
|
-
super
|
24
|
-
end
|
17
|
+
ImageSearch.new(@data_hash["asin"]).find
|
25
18
|
end
|
26
19
|
|
27
20
|
end
|
28
21
|
|
29
22
|
class ItemAttributes
|
30
|
-
attr_accessor :
|
23
|
+
attr_accessor :data_hash
|
24
|
+
include Methodize
|
31
25
|
|
32
26
|
def initialize(item_attributes)
|
33
|
-
@
|
34
|
-
end
|
35
|
-
|
36
|
-
def method_missing(meth,*args)
|
37
|
-
@item_attributes_hash[meth.to_s]
|
27
|
+
@data_hash = item_attributes
|
38
28
|
end
|
39
29
|
|
40
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: handcrafted-a2ws
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Shen
|
@@ -56,6 +56,7 @@ files:
|
|
56
56
|
- lib/a2ws/image_search.rb
|
57
57
|
- lib/a2ws/item.rb
|
58
58
|
- lib/a2ws/item_search.rb
|
59
|
+
- lib/a2ws/methodize.rb
|
59
60
|
- spec/a2ws_spec.rb
|
60
61
|
- spec/spec_helper.rb
|
61
62
|
has_rdoc: true
|