shopify_api 3.2.7 → 4.0.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2428da6b7703c5b237979e5eb938d5c06fff4f87
4
- data.tar.gz: bfe33434d71835e41dbc829aff4f5b00372b9d04
3
+ metadata.gz: 16a1cc4645fabc273ed6949ec27ccb17a3381488
4
+ data.tar.gz: ff56c49090a74e23cafb17bdbf941b04124604bb
5
5
  SHA512:
6
- metadata.gz: 8dc14e3d75bc4bb4201d8316ee76be9e0520fdb6c5558852c7e14c30a941dff4b77e3b7137163e0aa3fc43a18af6c7014e94cfcdecb41cf5042ee181281ce29c
7
- data.tar.gz: a918fea8cbbdfac6af12f919903c6502d5440cd8980264f736f9c79147074229d157e77b45bf337cb5acb3c515a28da23b8b31ed0267656e311f119bdfa47e3e
6
+ metadata.gz: 6d0f540c231f47f5b239b7937578588f3e31d3df00156a2aeb199817969f02eb74bc89c5cca65b16f84a5ecac5e0eb8012a47e46f0d01722b1914eb5a08a80b0
7
+ data.tar.gz: 4fb110853ebf1eec0247ecd5b9f132ac6a9a69f677ac1aebac076a8b27f7eece474a0279e300328997284d41d5edfaf16346175232157d206bdec1ab78c9f404
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/Gemfile.lock CHANGED
@@ -1,10 +1,8 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (3.2.7)
4
+ shopify_api (4.0.0)
5
5
  activeresource
6
- pry (>= 0.9.12.6)
7
- thor (~> 0.18.1)
8
6
 
9
7
  GEM
10
8
  remote: https://rubygems.org/
@@ -23,24 +21,16 @@ GEM
23
21
  thread_safe (~> 0.1)
24
22
  tzinfo (~> 0.3.37)
25
23
  builder (3.1.4)
26
- coderay (1.1.0)
27
24
  fakeweb (1.3.0)
28
25
  i18n (0.7.0)
29
26
  metaclass (0.0.1)
30
- method_source (0.8.2)
31
27
  minitest (4.7.5)
32
28
  mocha (0.14.0)
33
29
  metaclass (~> 0.0.1)
34
30
  multi_json (1.10.1)
35
- pry (0.10.1)
36
- coderay (~> 1.1.0)
37
- method_source (~> 0.8.1)
38
- slop (~> 3.4)
39
31
  rails-observers (0.1.2)
40
32
  activemodel (~> 4.0)
41
33
  rake (10.1.0)
42
- slop (3.6.0)
43
- thor (0.18.1)
44
34
  thread_safe (0.3.4)
45
35
  tzinfo (0.3.42)
46
36
 
data/bin/shopify CHANGED
@@ -1,4 +1,3 @@
1
1
  #!/usr/bin/env ruby
2
- require File.expand_path('../../lib/shopify_api',__FILE__)
3
- require File.expand_path('../../lib/shopify_api/cli',__FILE__)
4
- ShopifyAPI::Cli.start(ARGV)
2
+ puts "shopify command is no longer bundled with shopify_api."
3
+ puts "if you need these tools, install the shopify_cli gem"
@@ -1,3 +1,3 @@
1
1
  module ShopifyAPI
2
- VERSION = "3.2.7"
2
+ VERSION = "4.0.0"
3
3
  end
data/shopify_api.gemspec CHANGED
@@ -25,18 +25,16 @@ Gem::Specification.new do |s|
25
25
  s.license = 'MIT'
26
26
 
27
27
  s.add_dependency("activeresource")
28
- s.add_dependency("thor", ["~> 0.18.1"])
29
- s.add_dependency("pry", [">= 0.9.12.6"])
28
+
29
+ dev_dependencies = [['mocha', '>= 0.9.8'],
30
+ ['fakeweb'],
31
+ ['minitest', '~> 4.0'],
32
+ ['rake']
33
+ ]
30
34
 
31
35
  if s.respond_to?(:add_development_dependency)
32
- s.add_development_dependency("mocha", ">= 0.9.8")
33
- s.add_development_dependency("fakeweb")
34
- s.add_development_dependency("minitest", "~> 4.0")
35
- s.add_development_dependency("rake")
36
+ dev_dependencies.each { |dep| s.add_development_dependency(*dep) }
36
37
  else
37
- s.add_dependency("mocha", ">= 0.9.8")
38
- s.add_dependency("fakeweb")
39
- s.add_dependency("minitest", "~> 4.0")
40
- s.add_dependency("rake")
38
+ dev_dependencies.each { |dep| s.add_dependency(*dep) }
41
39
  end
42
40
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.7
4
+ version: 4.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
@@ -30,7 +30,7 @@ cert_chain:
30
30
  fl3hbtVFTqbOlwL9vy1fudXcolIE/ZTcxQ+er07ZFZdKCXayR9PPs64heamfn0fp
31
31
  TConQSX2BnZdhIEYW+cKzEC/bLc=
32
32
  -----END CERTIFICATE-----
33
- date: 2015-01-15 00:00:00.000000000 Z
33
+ date: 2015-04-22 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: activeresource
@@ -46,34 +46,6 @@ dependencies:
46
46
  - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
- - !ruby/object:Gem::Dependency
50
- name: thor
51
- requirement: !ruby/object:Gem::Requirement
52
- requirements:
53
- - - "~>"
54
- - !ruby/object:Gem::Version
55
- version: 0.18.1
56
- type: :runtime
57
- prerelease: false
58
- version_requirements: !ruby/object:Gem::Requirement
59
- requirements:
60
- - - "~>"
61
- - !ruby/object:Gem::Version
62
- version: 0.18.1
63
- - !ruby/object:Gem::Dependency
64
- name: pry
65
- requirement: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: 0.9.12.6
70
- type: :runtime
71
- prerelease: false
72
- version_requirements: !ruby/object:Gem::Requirement
73
- requirements:
74
- - - ">="
75
- - !ruby/object:Gem::Version
76
- version: 0.9.12.6
77
49
  - !ruby/object:Gem::Dependency
78
50
  name: mocha
79
51
  requirement: !ruby/object:Gem::Requirement
@@ -166,7 +138,6 @@ files:
166
138
  - lib/active_resource/json_errors.rb
167
139
  - lib/active_resource/to_query.rb
168
140
  - lib/shopify_api.rb
169
- - lib/shopify_api/cli.rb
170
141
  - lib/shopify_api/countable.rb
171
142
  - lib/shopify_api/events.rb
172
143
  - lib/shopify_api/json_format.rb
@@ -233,7 +204,6 @@ files:
233
204
  - test/carrier_service_test.rb
234
205
  - test/cart_test.rb
235
206
  - test/checkouts_test.rb
236
- - test/cli_test.rb
237
207
  - test/customer_saved_search_test.rb
238
208
  - test/customer_test.rb
239
209
  - test/detailed_log_subscriber_test.rb
metadata.gz.sig CHANGED
Binary file
@@ -1,178 +0,0 @@
1
- require 'thor'
2
- require 'abbrev'
3
- require 'yaml'
4
-
5
- module ShopifyAPI
6
- class Cli < Thor
7
- include Thor::Actions
8
-
9
- class ConfigFileError < StandardError
10
- end
11
-
12
- desc "list", "list available connections"
13
- def list
14
- available_connections.each do |c|
15
- prefix = default?(c) ? " * " : " "
16
- puts prefix + c
17
- end
18
- end
19
-
20
- desc "add CONNECTION", "create a config file for a connection named CONNECTION"
21
- def add(connection)
22
- file = config_file(connection)
23
- if File.exist?(file)
24
- raise ConfigFileError, "There is already a config file at #{file}"
25
- else
26
- config = {'protocol' => 'https'}
27
- config['domain'] = ask("Domain? (leave blank for #{connection}.myshopify.com)")
28
- config['domain'] = "#{connection}.myshopify.com" if config['domain'].blank?
29
- config['domain'] = "#{config['domain']}.myshopify.com" unless config['domain'].match(/[.:]/)
30
- puts "\nopen https://#{config['domain']}/admin/apps/private in your browser to create a private app and get API credentials\n"
31
- config['api_key'] = ask("API key?")
32
- config['password'] = ask("Password?")
33
- if ask("Would you like to use pry as your shell? (y/n)") === "y"
34
- config["shell"] = "pry"
35
- else
36
- config["shell"] = "irb"
37
- end
38
- create_file(file, config.to_yaml)
39
- end
40
- if available_connections.one?
41
- default(connection)
42
- end
43
- end
44
-
45
- desc "remove CONNECTION", "remove the config file for CONNECTION"
46
- def remove(connection)
47
- file = config_file(connection)
48
- if File.exist?(file)
49
- remove_file(default_symlink) if default?(connection)
50
- remove_file(file)
51
- else
52
- no_config_file_error(file)
53
- end
54
- end
55
-
56
- desc "edit [CONNECTION]", "open the config file for CONNECTION with your default editor"
57
- def edit(connection=nil)
58
- file = config_file(connection)
59
- if File.exist?(file)
60
- if ENV['EDITOR'].present?
61
- system(ENV['EDITOR'], file)
62
- else
63
- puts "Please set an editor in the EDITOR environment variable"
64
- end
65
- else
66
- no_config_file_error(file)
67
- end
68
- end
69
-
70
- desc "show [CONNECTION]", "output the location and contents of the CONNECTION's config file"
71
- def show(connection=nil)
72
- connection ||= default_connection
73
- file = config_file(connection)
74
- if File.exist?(file)
75
- puts file
76
- puts `cat #{file}`
77
- else
78
- no_config_file_error(file)
79
- end
80
- end
81
-
82
- desc "default [CONNECTION]", "show the default connection, or make CONNECTION the default"
83
- def default(connection=nil)
84
- if connection
85
- target = config_file(connection)
86
- if File.exist?(target)
87
- remove_file(default_symlink)
88
- `ln -s #{target} #{default_symlink}`
89
- else
90
- no_config_file_error(target)
91
- end
92
- end
93
- if File.exist?(default_symlink)
94
- puts "Default connection is #{default_connection}"
95
- else
96
- puts "There is no default connection set"
97
- end
98
- end
99
-
100
- desc "console [CONNECTION]", "start an API console for CONNECTION"
101
- def console(connection=nil)
102
- file = config_file(connection)
103
-
104
- config = YAML.load(File.read(file))
105
- puts "using #{config['domain']}"
106
- ShopifyAPI::Base.site = site_from_config(config)
107
-
108
- launch_shell(config)
109
- end
110
-
111
- tasks.keys.abbrev.each do |shortcut, command|
112
- map shortcut => command.to_sym
113
- end
114
-
115
- private
116
-
117
- def shop_config_dir
118
- @shop_config_dir ||= File.join(ENV['HOME'], '.shopify', 'shops')
119
- end
120
-
121
- def default_symlink
122
- @default_symlink ||= File.join(shop_config_dir, 'default')
123
- end
124
-
125
- def config_file(connection)
126
- if connection
127
- File.join(shop_config_dir, "#{connection}.yml")
128
- else
129
- default_symlink
130
- end
131
- end
132
-
133
- def site_from_config(config)
134
- protocol = config['protocol'] || 'https'
135
- api_key = config['api_key']
136
- password = config['password']
137
- domain = config['domain']
138
-
139
- ShopifyAPI::Base.site = "#{protocol}://#{api_key}:#{password}@#{domain}/admin"
140
- end
141
-
142
- def launch_shell(config)
143
- if config["shell"] === "pry"
144
- require 'pry'
145
- ARGV.clear
146
- Pry.start
147
- else
148
- require 'irb'
149
- require 'irb/completion'
150
- ARGV.clear
151
- IRB.start
152
- end
153
- end
154
-
155
- def available_connections
156
- @available_connections ||= begin
157
- pattern = File.join(shop_config_dir, "*.yml")
158
- Dir.glob(pattern).map { |f| File.basename(f, ".yml") }
159
- end
160
- end
161
-
162
- def default_connection_target
163
- @default_connection_target ||= File.readlink(default_symlink)
164
- end
165
-
166
- def default_connection
167
- @default_connection ||= File.basename(default_connection_target, ".yml")
168
- end
169
-
170
- def default?(connection)
171
- default_connection == connection
172
- end
173
-
174
- def no_config_file_error(filename)
175
- raise ConfigFileError, "There is no config file at #{filename}"
176
- end
177
- end
178
- end
data/test/cli_test.rb DELETED
@@ -1,124 +0,0 @@
1
- require 'test_helper'
2
- require 'shopify_api/cli'
3
- require 'fileutils'
4
-
5
- class CliTest < Test::Unit::TestCase
6
- def setup
7
- @test_home = File.join(File.expand_path(File.dirname(__FILE__)), 'files', 'home')
8
- @shop_config_dir = File.join(@test_home, '.shopify', 'shops')
9
- @default_symlink = File.join(@shop_config_dir, 'default')
10
- `rm -rf #{@test_home}`
11
- ENV['HOME'] = @test_home
12
- @cli = ShopifyAPI::Cli.new
13
-
14
- FileUtils.mkdir_p(@shop_config_dir)
15
- File.open(config_file('foo'), 'w') do |file|
16
- file.puts valid_options.merge('domain' => 'foo.myshopify.com').to_yaml
17
- end
18
- File.symlink(config_file('foo'), @default_symlink)
19
- File.open(config_file('bar'), 'w') do |file|
20
- file.puts valid_options.merge('domain' => 'bar.myshopify.com').to_yaml
21
- end
22
- end
23
-
24
- def teardown
25
- `rm -rf #{@test_home}`
26
- end
27
-
28
- test "add with blank domain" do
29
- standard_add_shop_prompts
30
- $stdin.expects(:gets).times(4).returns("", "key", "pass", "y")
31
- @cli.expects(:puts).with("\nopen https://foo.myshopify.com/admin/apps/private in your browser to create a private app and get API credentials\n")
32
- @cli.expects(:puts).with("Default connection is foo")
33
-
34
- @cli.add('foo')
35
-
36
- config = YAML.load(File.read(config_file('foo')))
37
- assert_equal 'foo.myshopify.com', config['domain']
38
- assert_equal 'key', config['api_key']
39
- assert_equal 'pass', config['password']
40
- assert_equal 'pry', config['shell']
41
- assert_equal 'https', config['protocol']
42
- assert_equal config_file('foo'), File.readlink(@default_symlink)
43
- end
44
-
45
- test "add with explicit domain" do
46
- standard_add_shop_prompts
47
- $stdin.expects(:gets).times(4).returns("bar.myshopify.com", "key", "pass", "y")
48
- @cli.expects(:puts).with("\nopen https://bar.myshopify.com/admin/apps/private in your browser to create a private app and get API credentials\n")
49
- @cli.expects(:puts).with("Default connection is foo")
50
-
51
- @cli.add('foo')
52
-
53
- config = YAML.load(File.read(config_file('foo')))
54
- assert_equal 'bar.myshopify.com', config['domain']
55
- end
56
-
57
- test "add with irb as shell" do
58
- standard_add_shop_prompts
59
- $stdin.expects(:gets).times(4).returns("bar.myshopify.com", "key", "pass", "fuuuuuuu")
60
- @cli.expects(:puts).with("\nopen https://bar.myshopify.com/admin/apps/private in your browser to create a private app and get API credentials\n")
61
- @cli.expects(:puts).with("Default connection is foo")
62
-
63
- @cli.add('foo')
64
-
65
- config = YAML.load(File.read(config_file('foo')))
66
- assert_equal 'irb', config['shell']
67
- end
68
-
69
- test "list" do
70
- @cli.expects(:puts).with(" bar")
71
- @cli.expects(:puts).with(" * foo")
72
-
73
- @cli.list
74
- end
75
-
76
- test "show default" do
77
- @cli.expects(:puts).with("Default connection is foo")
78
-
79
- @cli.default
80
- end
81
-
82
- test "set default" do
83
- @cli.expects(:puts).with("Default connection is bar")
84
-
85
- @cli.default('bar')
86
-
87
- assert_equal config_file('bar'), File.readlink(@default_symlink)
88
- end
89
-
90
- test "remove default connection" do
91
- @cli.remove('foo')
92
-
93
- assert !File.exist?(@default_symlink)
94
- assert !File.exist?(config_file('foo'))
95
- assert File.exist?(config_file('bar'))
96
- end
97
-
98
- test "remove non-default connection" do
99
- @cli.remove('bar')
100
-
101
- assert_equal config_file('foo'), File.readlink(@default_symlink)
102
- assert File.exist?(config_file('foo'))
103
- assert !File.exist?(config_file('bar'))
104
- end
105
-
106
- private
107
-
108
- def valid_options
109
- {'domain' => 'snowdevil.myshopify.com', 'api_key' => 'key', 'password' => 'pass', 'shell' => 'pry', 'protocol' => 'https'}
110
- end
111
-
112
- def config_file(connection)
113
- File.join(@shop_config_dir, "#{connection}.yml")
114
- end
115
-
116
- def standard_add_shop_prompts
117
- `rm -rf #{@shop_config_dir}/*`
118
- $stdout.expects(:print).with("Domain? (leave blank for foo.myshopify.com) ")
119
- $stdout.expects(:print).with("API key? ")
120
- $stdout.expects(:print).with("Password? ")
121
- $stdout.expects(:print).with("Would you like to use pry as your shell? (y/n) ")
122
- end
123
-
124
- end