zendesk_apps_tools 2.0.6 → 2.0.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dde3cf9743fb66d2cd461b4db74033cc4d675371
4
- data.tar.gz: 6227eaaff8be779ae75f08503106b777d35b8f13
3
+ metadata.gz: 0e7d6b299a5da2b66693249f07d74a807d06436f
4
+ data.tar.gz: a40ba73b1a3a97a805ab289407492b818b8d69f8
5
5
  SHA512:
6
- metadata.gz: b23e03abce5b45dd88310a787edeab0c405e9b432e95b618f14e081ec12475e4deedadbaef10981dbef1a93957d28ed8649190bf234c56082eb6b50f2699e778
7
- data.tar.gz: 8e1094b299535bfd64724b01755f39289581f82dfce59a79ff8481561c7843bb5ecb9abd72585087361d9531cb9dfc4d9ae3201ff441833139af7df6a3536279
6
+ metadata.gz: 853c67600f5fd2864735011984fb6fe665785f002593a3cdd3f04c89d3c20139931d17f18f6e2ebb5bdacd27afbd6e128d770f139f767a9f6e55a4ee50307601
7
+ data.tar.gz: 0e49261911a2349ac3ce6b10415c6c24f54d571569dadf1ebfe422b70e4a99d869d14b0a484554041773e52e8f4cae3db1daff1b0460aaa557d4e869dc58489a
@@ -6,7 +6,7 @@ unless defined?(Cucumber)
6
6
  require 'webmock'
7
7
 
8
8
  WebMock::API.stub_request(:post, 'https://app-account.zendesk.com/api/v2/apps/uploads.json').to_return(body: JSON.dump(id: '123'))
9
- WebMock::API.stub_request(:post, 'https://app-account.zendesk.com/api/v2/apps.json').with(body: JSON.dump(name: 'John Test App', upload_id: '123')).to_return(body: JSON.dump(job_id: '987'))
9
+ WebMock::API.stub_request(:post, 'https://app-account.zendesk.com/api/apps.json').with(body: JSON.dump(name: 'John Test App', upload_id: '123')).to_return(body: JSON.dump(job_id: '987'))
10
10
  WebMock::API.stub_request(:get, 'https://app-account.zendesk.com/api/v2/apps/job_statuses/987').to_return(body: JSON.dump(status: 'working')).then.to_return(body: JSON.dump(status: 'completed', app_id: '55'))
11
11
 
12
12
  WebMock.enable!
@@ -162,11 +162,13 @@ module ZendeskAppsTools
162
162
  app_name = manifest.name
163
163
  end
164
164
  app_name ||= get_value_from_stdin('Enter app name:')
165
- deploy_app(:post, '/api/v2/apps.json', name: app_name)
165
+ deploy_app(:post, '/api/apps.json', name: app_name)
166
166
  has_requirements = File.exist?(File.join(options[:path], 'requirements.json'))
167
167
  return unless options[:install]
168
- say_status 'Install', 'installing'
169
- install_app(has_requirements, app_id: cache.fetch('app_id'), settings: settings.merge(name: app_name))
168
+ product_names(manifest).each do |product_name|
169
+ say_status 'Install', "installing in #{product_name}"
170
+ install_app(has_requirements, product_name, app_id: cache.fetch('app_id'), settings: settings.merge(name: app_name))
171
+ end
170
172
  end
171
173
 
172
174
  desc 'update', 'Update app on the server'
@@ -191,6 +193,14 @@ module ZendeskAppsTools
191
193
 
192
194
  protected
193
195
 
196
+ def product_names(manifest)
197
+ product_codes(manifest).collect{ |code| ZendeskAppsSupport::Product.find_by( code: code ) }.collect(&:name)
198
+ end
199
+
200
+ def product_codes(manifest)
201
+ manifest.location_options.collect{ |option| option.location.product_code }
202
+ end
203
+
194
204
  def setup_path(path)
195
205
  @destination_stack << relative_to_original_destination_root(path) unless @destination_stack.last == path
196
206
  end
@@ -16,10 +16,10 @@ module ZendeskAppsTools
16
16
  say_error_and_exit e.message
17
17
  end
18
18
 
19
- def install_app(poll_job, installation)
19
+ def install_app(poll_job, product_name, installation)
20
20
  connection = get_connection
21
21
  response = connection.post do |req|
22
- req.url 'api/v2/apps/installations.json'
22
+ req.url "api/#{product_name}/apps/installations.json"
23
23
  req.headers[:content_type] = 'application/json'
24
24
  req.body = JSON.generate(installation)
25
25
  end
@@ -52,7 +52,7 @@ module ZendeskAppsTools
52
52
 
53
53
  connection = get_connection
54
54
 
55
- all_apps = connection.get('/api/v2/apps.json').body
55
+ all_apps = connection.get('/api/apps.json').body
56
56
 
57
57
  app_json = json_or_die(all_apps)['apps'].find { |app| app['name'] == name }
58
58
  say_error_and_exit('The app was not found. Please verify your credentials, subdomain, and app name are correct.') unless app_json
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module ZendeskAppsTools
3
- VERSION = '2.0.6'
3
+ VERSION = '2.0.7'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zendesk_apps_tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.6
4
+ version: 2.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - James A. Rosen
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2017-06-28 00:00:00.000000000 Z
14
+ date: 2017-07-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: thor
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  version: 1.3.6
248
248
  requirements: []
249
249
  rubyforge_project:
250
- rubygems_version: 2.4.5.1
250
+ rubygems_version: 2.4.6
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Tools to help you develop Zendesk Apps.