shopify_api 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,9 @@
1
+ == Version 1.2.1
2
+
3
+ * Allow abbreviated names for all commands like rails does, e.g. 'shopify c' instead of 'shopify console'
4
+ * Fix Variant to support accessing both nested variants with a product prefix as well as top level variants directly
5
+ * Add 'grande' to supported product image size variants
6
+
1
7
  == Version 1.2.0
2
8
 
3
9
  * Command-line interface
@@ -1,6 +1,7 @@
1
1
  require 'active_resource'
2
2
  require 'active_support/core_ext/class/attribute_accessors'
3
3
  require 'digest/md5'
4
+ require 'base64'
4
5
 
5
6
  module ShopifyAPI
6
7
  METAFIELD_ENABLED_CLASSES = %w( Order Product CustomCollection SmartCollection Page Blog Article Variant)
@@ -301,13 +302,17 @@ module ShopifyAPI
301
302
 
302
303
  class Variant < Base
303
304
  self.prefix = "/admin/products/:product_id/"
305
+
306
+ def self.prefix(options={})
307
+ options[:product_id].nil? ? "/admin/" : "/admin/products/#{options[:product_id]}/"
308
+ end
304
309
  end
305
310
 
306
311
  class Image < Base
307
312
  self.prefix = "/admin/products/:product_id/"
308
313
 
309
314
  # generate a method for each possible image variant
310
- [:pico, :icon, :thumb, :small, :compact, :medium, :large, :original].each do |m|
315
+ [:pico, :icon, :thumb, :small, :compact, :medium, :large, :grande, :original].each do |m|
311
316
  reg_exp_match = "/\\1_#{m}.\\2"
312
317
  define_method(m) { src.gsub(/\/(.*)\.(\w{2,4})/, reg_exp_match) }
313
318
  end
@@ -1,4 +1,5 @@
1
1
  require 'thor'
2
+ require 'abbrev'
2
3
 
3
4
  module ShopifyAPI
4
5
  class Cli < Thor
@@ -6,6 +7,10 @@ module ShopifyAPI
6
7
 
7
8
  class ConfigFileError < StandardError
8
9
  end
10
+
11
+ tasks.keys.abbrev.each do |shortcut, command|
12
+ map shortcut => command.to_sym
13
+ end
9
14
 
10
15
  desc "list", "list available connections"
11
16
  def list
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{shopify_api}
5
- s.version = "1.2.0"
5
+ s.version = "1.2.1"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Tobias L\303\274tke", "Cody Fauser", "Dennis Theisen"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
8
  - 2
9
- - 0
10
- version: 1.2.0
9
+ - 1
10
+ version: 1.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - "Tobias L\xC3\xBCtke"