shopify_api 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +0 -2
- data/VERSION +1 -1
- data/lib/shopify_api.rb +32 -30
- data/shopify_api.gemspec +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
@@ -14,8 +14,6 @@ begin
|
|
14
14
|
gem.add_dependency('activeresource', '>= 2.2.2')
|
15
15
|
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
16
|
end
|
17
|
-
|
18
|
-
Jeweler::RubyforgeTasks.new
|
19
17
|
rescue LoadError
|
20
18
|
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
21
19
|
end
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.4
|
data/lib/shopify_api.rb
CHANGED
@@ -2,7 +2,7 @@ require 'active_resource'
|
|
2
2
|
require 'digest/md5'
|
3
3
|
|
4
4
|
module ShopifyAPI
|
5
|
-
METAFIELD_ENABLED_CLASSES = %w( Order Product CustomCollection SmartCollection Page Blog Article )
|
5
|
+
METAFIELD_ENABLED_CLASSES = %w( Order Product CustomCollection SmartCollection Page Blog Article Variant)
|
6
6
|
|
7
7
|
module Countable
|
8
8
|
def count(options = {})
|
@@ -11,21 +11,21 @@ module ShopifyAPI
|
|
11
11
|
end
|
12
12
|
|
13
13
|
module Metafields
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
14
|
+
def metafields
|
15
|
+
Metafield.find(:all, :params => {:resource => self.class.collection_name, :resource_id => id})
|
16
|
+
end
|
17
|
+
|
18
|
+
def add_metafield(metafield)
|
19
|
+
raise ArgumentError, "You can only add metafields to resource that has been saved" if new?
|
20
|
+
|
21
|
+
metafield.prefix_options = {
|
22
|
+
:resource => self.class.collection_name,
|
23
|
+
:resource_id => id
|
24
|
+
}
|
25
|
+
metafield.save
|
26
|
+
metafield
|
27
|
+
end
|
28
|
+
end
|
29
29
|
|
30
30
|
#
|
31
31
|
# The Shopify API authenticates each call via HTTP Authentication, using
|
@@ -215,8 +215,8 @@ module ShopifyAPI
|
|
215
215
|
def products
|
216
216
|
Product.find(:all, :params => {:collection_id => self.id})
|
217
217
|
end
|
218
|
-
end
|
219
|
-
|
218
|
+
end
|
219
|
+
|
220
220
|
# For adding/removing products from custom collections
|
221
221
|
class Collect < Base
|
222
222
|
end
|
@@ -329,19 +329,19 @@ module ShopifyAPI
|
|
329
329
|
end
|
330
330
|
|
331
331
|
class Metafield < Base
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
332
|
+
self.prefix = "/admin/:resource/:resource_id/"
|
333
|
+
|
334
|
+
# Hack to allow both Shop and other Metafields in through the same AR class
|
335
|
+
def self.prefix(options={})
|
336
|
+
options[:resource].nil? ? "/admin/" : "/admin/#{options[:resource]}/#{options[:resource_id]}/"
|
337
|
+
end
|
338
|
+
|
339
|
+
def value
|
340
|
+
return if attributes["value"].nil?
|
341
|
+
attributes["value_type"] == "integer" ? attributes["value"].to_i : attributes["value"]
|
342
|
+
end
|
343
343
|
|
344
|
-
|
344
|
+
end
|
345
345
|
|
346
346
|
class Comment < Base
|
347
347
|
def remove; load_attributes_from_response(post(:remove)); end
|
@@ -357,6 +357,8 @@ module ShopifyAPI
|
|
357
357
|
class Redirect < Base
|
358
358
|
end
|
359
359
|
|
360
|
+
class Webhook < Base
|
361
|
+
end
|
360
362
|
|
361
363
|
# Assets represent the files that comprise your theme.
|
362
364
|
# There are different buckets which hold different kinds
|
data/shopify_api.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{shopify_api}
|
8
|
-
s.version = "1.0.
|
8
|
+
s.version = "1.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Tobias L\303\274tke", "Cody Fauser", "Dennis Theisen"]
|