Class: Readiness::Zendesk::Apps
- Inherits:
-
Client
- Object
- Client
- Readiness::Zendesk::Apps
show all
- Defined in:
- lib/support_readiness/zendesk/apps.rb
Overview
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Client
auth_error, bad_request_error, convert_actions, convert_conditions, convert_standard_names_to_ids, convert_ticket_form_agent_conditions, convert_ticket_form_brands, convert_ticket_form_end_user_conditions, convert_ticket_form_names_to_ids, convert_view_names_to_ids, convert_view_restrictions, covert_ticket_form_field_ids, create_package!, erb_renderer, handle_request_error, not_found_error, not_processible_error, put_into_archive, recursively_deflate_directory, timestamp_filename, to_clean_json, to_clean_json_with_key, to_hash, to_nearly_clean_json, to_nearly_clean_json_with_key, to_param_string, write_entries
Constructor Details
#initialize(object = {}) ⇒ Apps
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'lib/support_readiness/zendesk/apps.rb', line 24
def initialize(object = {})
@author_email = object['author_email']
@author_name = object['author_name']
@author_url = object['author_url']
@categories = object['categories']
@closed_preview = object['closed_preview']
@default_locale = object['default_locale']
@deprecated = object['deprecated']
@featrure_color = object['featrure_color']
@featured = object['featured']
@framework_version = object['framework_version']
@google_analytics_code = object['google_analytics_code']
@id = object['id']
@installable = object['installable']
@installation_instructions = object['installation_instructions']
@large_icon = object['large_icon']
@long_description = object['long_description']
@marketing_only = object['marketing_only']
@name = object['name']
@obsolete = object['obsolete']
@owner_id = object['owner_id']
@paid = object['paid']
@parameters = object['parameters']
@products = object['products']
@promoted = object['promoted']
@raw_installation_instructions = object['raw_installation_instructions']
@raw_long_description = object['raw_long_description']
@remote_installation_url = object['remote_installation_url']
@screenshots = object['screenshots']
@short_description = object['short_description']
@single_install = object['single_install']
@small_icon = object['small_icon']
@state = object['state']
@terms_conditions_url = object['terms_conditions_url']
@version = object['version']
@visibility = object['visibility']
end
|
Instance Attribute Details
#author_email ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def author_email
@author_email
end
|
#author_name ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def author_name
@author_name
end
|
#author_url ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def author_url
@author_url
end
|
#categories ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def categories
@categories
end
|
#closed_preview ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def closed_preview
@closed_preview
end
|
#default_locale ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def default_locale
@default_locale
end
|
#deprecated ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def deprecated
@deprecated
end
|
#featrure_color ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def featrure_color
@featrure_color
end
|
#featured ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def featured
@featured
end
|
#framework_version ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def framework_version
@framework_version
end
|
#google_analytics_code ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def google_analytics_code
@google_analytics_code
end
|
#id ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def id
@id
end
|
#installable ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def installable
@installable
end
|
#installation_instructions ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def installation_instructions
@installation_instructions
end
|
#large_icon ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def large_icon
@large_icon
end
|
#long_description ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def long_description
@long_description
end
|
#marketing_only ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def marketing_only
@marketing_only
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def name
@name
end
|
#obsolete ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def obsolete
@obsolete
end
|
#owner_id ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def owner_id
@owner_id
end
|
#paid ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def paid
@paid
end
|
#parameters ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def parameters
@parameters
end
|
#products ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def products
@products
end
|
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def promoted
@promoted
end
|
#raw_installation_instructions ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def raw_installation_instructions
@raw_installation_instructions
end
|
#raw_long_description ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def raw_long_description
@raw_long_description
end
|
#remote_installation_url ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def remote_installation_url
@remote_installation_url
end
|
#screenshots ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def screenshots
@screenshots
end
|
#short_description ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def short_description
@short_description
end
|
#single_install ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def single_install
@single_install
end
|
#small_icon ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def small_icon
@small_icon
end
|
#state ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def state
@state
end
|
#terms_conditions_url ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def terms_conditions_url
@terms_conditions_url
end
|
#version ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def version
@version
end
|
#visibility ⇒ Object
13
14
15
|
# File 'lib/support_readiness/zendesk/apps.rb', line 13
def visibility
@visibility
end
|
Class Method Details
.find(client, aid) ⇒ Object
Locates an app within Zendesk. This will not exit on error (except Authentication errors)
105
106
107
108
109
110
111
|
# File 'lib/support_readiness/zendesk/apps.rb', line 105
def self.find(client, aid)
response = client.connection.get "apps/#{aid}"
handle_request_error(0, 'Zendesk', response.status, { action: 'get', id: aid }) unless response.status == 200
return Apps.new(Oj.load(response.body)) if response.status == 200
Oj.load(response.body)
end
|
.find!(client, aid) ⇒ Object
Locates an app within Zendesk. This will exit on error
132
133
134
135
136
|
# File 'lib/support_readiness/zendesk/apps.rb', line 132
def self.find!(client, aid)
response = client.connection.get "apps/#{aid}"
handle_request_error(1, 'Zendesk', response.status, { action: 'Find app', id: aid }) unless response.status == 200
Apps.new(Oj.load(response.body))
end
|
.list(client) ⇒ Array
Lists owned apps within Zendesk
80
81
82
83
84
|
# File 'lib/support_readiness/zendesk/apps.rb', line 80
def self.list(client)
response = client.connection.get 'apps/owned'
handle_request_error(0, 'Zendesk', response.status) unless response.status == 200
Oj.load(response.body)['apps'].map { |a| Apps.new(a) }
end
|
.package!(location = './') ⇒ String
Creates a zip file from the current working directory for a Zendesk app. This will exit on error
150
151
152
153
|
# File 'lib/support_readiness/zendesk/apps.rb', line 150
def self.package!(location = './')
item_list = %w[ assets translations manifest.json ]
create_package!(item_list, location)
end
|
.update!(client, app) ⇒ Object
Performs an app update job. This will exit on erorr
200
201
202
203
204
205
206
|
# File 'lib/support_readiness/zendesk/apps.rb', line 200
def self.update!(client, app)
file = package!
upload_id = upload!(client, file)
response = client.connection.put "apps/#{app.id}", { upload_id: upload_id }.to_json
handle_request_error(1, 'Zendesk', response.status, { action: 'Update app', id: app.id }) unless response.status == 200
AppJobStatuses.find!(client, Oj.load(response.body)['job_id'])
end
|
.upload!(client, file) ⇒ Integer
Uploads a zip file from the current working directory for a Zendesk app. This will exit on erorr
174
175
176
177
178
|
# File 'lib/support_readiness/zendesk/apps.rb', line 174
def self.upload!(client, file)
response = client.upload_connection.post 'apps/uploads', { uploaded_data: ::Faraday::UploadIO.new(file, 'application.zip') }
handle_request_error(1, 'Zendesk', response.status, { action: 'Upload app', id: file }) unless response.status == 200
Oj.load(response.body)['id']
end
|