dyspatch_client 3.0.1 → 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.
Files changed (107) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +2 -0
  3. data/README.md +35 -41
  4. data/Rakefile +2 -0
  5. data/docs/APIError.md +13 -2
  6. data/docs/CompiledRead.md +13 -0
  7. data/docs/Cursor.md +11 -1
  8. data/docs/DraftMetaRead.md +15 -0
  9. data/docs/DraftRead.md +17 -1
  10. data/docs/DraftsApi.md +140 -133
  11. data/docs/DraftsRead.md +11 -1
  12. data/docs/{Body.md → InlineObject.md} +10 -1
  13. data/docs/LocalizationKeyRead.md +10 -0
  14. data/docs/LocalizationMetaRead.md +14 -3
  15. data/docs/LocalizationRead.md +17 -1
  16. data/docs/LocalizationsApi.md +14 -13
  17. data/docs/TemplateMetaRead.md +16 -1
  18. data/docs/TemplateRead.md +17 -1
  19. data/docs/TemplatesApi.md +40 -36
  20. data/docs/TemplatesRead.md +11 -1
  21. data/dyspatch_client.gemspec +5 -11
  22. data/lib/dyspatch_client.rb +5 -19
  23. data/lib/dyspatch_client/api/drafts_api.rb +372 -236
  24. data/lib/dyspatch_client/api/localizations_api.rb +47 -30
  25. data/lib/dyspatch_client/api/templates_api.rb +98 -64
  26. data/lib/dyspatch_client/api_client.rb +40 -43
  27. data/lib/dyspatch_client/api_error.rb +23 -4
  28. data/lib/dyspatch_client/configuration.rb +48 -9
  29. data/lib/dyspatch_client/models/api_error.rb +46 -22
  30. data/lib/dyspatch_client/models/compiled_read.rb +45 -66
  31. data/lib/dyspatch_client/models/cursor.rb +43 -20
  32. data/lib/dyspatch_client/models/draft_meta_read.rb +49 -25
  33. data/lib/dyspatch_client/models/draft_read.rb +49 -25
  34. data/lib/dyspatch_client/models/drafts_read.rb +41 -17
  35. data/lib/dyspatch_client/models/{body.rb → inline_object.rb} +40 -17
  36. data/lib/dyspatch_client/models/localization_key_read.rb +41 -17
  37. data/lib/dyspatch_client/models/localization_meta_read.rb +53 -39
  38. data/lib/dyspatch_client/models/localization_read.rb +50 -26
  39. data/lib/dyspatch_client/models/template_meta_read.rb +48 -24
  40. data/lib/dyspatch_client/models/template_read.rb +49 -25
  41. data/lib/dyspatch_client/models/templates_read.rb +41 -17
  42. data/lib/dyspatch_client/version.rb +5 -5
  43. data/spec/api/drafts_api_spec.rb +61 -53
  44. data/spec/api/localizations_api_spec.rb +11 -10
  45. data/spec/api/templates_api_spec.rb +22 -20
  46. data/spec/api_client_spec.rb +5 -5
  47. data/spec/configuration_spec.rb +12 -14
  48. data/spec/integration_spec.rb +41 -0
  49. data/spec/models/api_error_spec.rb +6 -6
  50. data/spec/models/compiled_read_spec.rb +5 -5
  51. data/spec/models/cursor_spec.rb +5 -5
  52. data/spec/models/draft_meta_read_spec.rb +5 -5
  53. data/spec/models/draft_read_spec.rb +5 -5
  54. data/spec/models/drafts_read_spec.rb +5 -5
  55. data/spec/models/inline_object_spec.rb +41 -0
  56. data/spec/models/localization_key_read_spec.rb +5 -5
  57. data/spec/models/localization_meta_read_spec.rb +6 -12
  58. data/spec/models/localization_read_spec.rb +5 -5
  59. data/spec/models/template_meta_read_spec.rb +5 -5
  60. data/spec/models/template_read_spec.rb +5 -5
  61. data/spec/models/templates_read_spec.rb +5 -5
  62. data/spec/spec_helper.rb +4 -4
  63. metadata +15 -190
  64. data/docs/CreatedAt.md +0 -7
  65. data/docs/DraftDescription.md +0 -7
  66. data/docs/DraftId.md +0 -7
  67. data/docs/DraftName.md +0 -7
  68. data/docs/DraftUrl.md +0 -7
  69. data/docs/LanguageId.md +0 -7
  70. data/docs/LocalizationId.md +0 -7
  71. data/docs/LocalizationName.md +0 -7
  72. data/docs/LocalizationUrl.md +0 -7
  73. data/docs/TemplateDescription.md +0 -7
  74. data/docs/TemplateId.md +0 -7
  75. data/docs/TemplateName.md +0 -7
  76. data/docs/TemplateUrl.md +0 -7
  77. data/docs/UpdatedAt.md +0 -7
  78. data/git_push.sh +0 -55
  79. data/lib/dyspatch_client/models/created_at.rb +0 -175
  80. data/lib/dyspatch_client/models/draft_description.rb +0 -175
  81. data/lib/dyspatch_client/models/draft_id.rb +0 -175
  82. data/lib/dyspatch_client/models/draft_name.rb +0 -175
  83. data/lib/dyspatch_client/models/draft_url.rb +0 -175
  84. data/lib/dyspatch_client/models/language_id.rb +0 -175
  85. data/lib/dyspatch_client/models/localization_id.rb +0 -175
  86. data/lib/dyspatch_client/models/localization_name.rb +0 -175
  87. data/lib/dyspatch_client/models/localization_url.rb +0 -175
  88. data/lib/dyspatch_client/models/template_description.rb +0 -175
  89. data/lib/dyspatch_client/models/template_id.rb +0 -175
  90. data/lib/dyspatch_client/models/template_name.rb +0 -175
  91. data/lib/dyspatch_client/models/template_url.rb +0 -175
  92. data/lib/dyspatch_client/models/updated_at.rb +0 -175
  93. data/spec/models/body_spec.rb +0 -41
  94. data/spec/models/created_at_spec.rb +0 -35
  95. data/spec/models/draft_description_spec.rb +0 -35
  96. data/spec/models/draft_id_spec.rb +0 -35
  97. data/spec/models/draft_name_spec.rb +0 -35
  98. data/spec/models/draft_url_spec.rb +0 -35
  99. data/spec/models/language_id_spec.rb +0 -35
  100. data/spec/models/localization_id_spec.rb +0 -35
  101. data/spec/models/localization_name_spec.rb +0 -35
  102. data/spec/models/localization_url_spec.rb +0 -35
  103. data/spec/models/template_description_spec.rb +0 -35
  104. data/spec/models/template_id_spec.rb +0 -35
  105. data/spec/models/template_name_spec.rb +0 -35
  106. data/spec/models/template_url_spec.rb +0 -35
  107. data/spec/models/updated_at_spec.rb +0 -35
@@ -1,16 +1,16 @@
1
1
  =begin
2
2
  #Dyspatch API
3
3
 
4
- ## Introduction The Dyspatch API is based on the REST paradigm and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for the following languages and web frameworks: - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module DyspatchClient
16
16
  class LocalizationsApi
@@ -20,65 +20,82 @@ module DyspatchClient
20
20
  @api_client = api_client
21
21
  end
22
22
  # Get Localization Object by ID
23
- # Returns a specific localization object with a matching ID.
24
- # @param localization_id A localization ID
25
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
23
+ # Returns a specific localization object with a matching ID
24
+ # @param localization_id [String] A localization ID
25
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
26
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \"2019.10\", set the value to \"application/vnd.dyspatch.2019.10+json\"
26
27
  # @param [Hash] opts the optional parameters
27
28
  # @return [LocalizationRead]
28
- def localizations_localization_id_get(localization_id, target_language, opts = {})
29
- data, _status_code, _headers = localizations_localization_id_get_with_http_info(localization_id, target_language, opts)
29
+ def get_localization_by_id(localization_id, target_language, accept, opts = {})
30
+ data, _status_code, _headers = get_localization_by_id_with_http_info(localization_id, target_language, accept, opts)
30
31
  data
31
32
  end
32
33
 
33
34
  # Get Localization Object by ID
34
- # Returns a specific localization object with a matching ID.
35
- # @param localization_id A localization ID
36
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
35
+ # Returns a specific localization object with a matching ID
36
+ # @param localization_id [String] A localization ID
37
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
38
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \"2019.10\", set the value to \"application/vnd.dyspatch.2019.10+json\"
37
39
  # @param [Hash] opts the optional parameters
38
- # @return [Array<(LocalizationRead, Fixnum, Hash)>] LocalizationRead data, response status code and response headers
39
- def localizations_localization_id_get_with_http_info(localization_id, target_language, opts = {})
40
+ # @return [Array<(LocalizationRead, Integer, Hash)>] LocalizationRead data, response status code and response headers
41
+ def get_localization_by_id_with_http_info(localization_id, target_language, accept, opts = {})
40
42
  if @api_client.config.debugging
41
- @api_client.config.logger.debug 'Calling API: LocalizationsApi.localizations_localization_id_get ...'
43
+ @api_client.config.logger.debug 'Calling API: LocalizationsApi.get_localization_by_id ...'
42
44
  end
43
45
  # verify the required parameter 'localization_id' is set
44
46
  if @api_client.config.client_side_validation && localization_id.nil?
45
- fail ArgumentError, "Missing the required parameter 'localization_id' when calling LocalizationsApi.localizations_localization_id_get"
47
+ fail ArgumentError, "Missing the required parameter 'localization_id' when calling LocalizationsApi.get_localization_by_id"
46
48
  end
47
49
  # verify the required parameter 'target_language' is set
48
50
  if @api_client.config.client_side_validation && target_language.nil?
49
- fail ArgumentError, "Missing the required parameter 'target_language' when calling LocalizationsApi.localizations_localization_id_get"
51
+ fail ArgumentError, "Missing the required parameter 'target_language' when calling LocalizationsApi.get_localization_by_id"
50
52
  end
51
53
  # verify enum value
52
- if @api_client.config.client_side_validation && !['html', 'jinja', 'handlebars', 'ampscript', 'freemarker', 'cheetah'].include?(target_language)
53
- fail ArgumentError, "invalid value for 'target_language', must be one of html, jinja, handlebars, ampscript, freemarker, cheetah"
54
+ allowable_values = ["html", "handlebars", "ampscript", "freemarker", "cheetah"]
55
+ if @api_client.config.client_side_validation && !allowable_values.include?(target_language)
56
+ fail ArgumentError, "invalid value for \"target_language\", must be one of #{allowable_values}"
57
+ end
58
+ # verify the required parameter 'accept' is set
59
+ if @api_client.config.client_side_validation && accept.nil?
60
+ fail ArgumentError, "Missing the required parameter 'accept' when calling LocalizationsApi.get_localization_by_id"
54
61
  end
55
62
  # resource path
56
- local_var_path = '/localizations/{localizationId}'.sub('{' + 'localizationId' + '}', localization_id.to_s)
63
+ local_var_path = '/localizations/{localizationId}'.sub('{' + 'localizationId' + '}', CGI.escape(localization_id.to_s))
57
64
 
58
65
  # query parameters
59
- query_params = {}
66
+ query_params = opts[:query_params] || {}
60
67
  query_params[:'targetLanguage'] = target_language
61
68
 
62
69
  # header parameters
63
- header_params = {}
70
+ header_params = opts[:header_params] || {}
64
71
  # HTTP header 'Accept' (if needed)
65
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
72
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json', '*/*'])
73
+ header_params[:'Accept'] = accept
66
74
 
67
75
  # form parameters
68
- form_params = {}
76
+ form_params = opts[:form_params] || {}
69
77
 
70
78
  # http body (model)
71
- post_body = nil
72
- auth_names = ['Bearer']
73
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
79
+ post_body = opts[:body]
80
+
81
+ # return_type
82
+ return_type = opts[:return_type] || 'LocalizationRead'
83
+
84
+ # auth_names
85
+ auth_names = opts[:auth_names] || ['Bearer']
86
+
87
+ new_options = opts.merge(
74
88
  :header_params => header_params,
75
89
  :query_params => query_params,
76
90
  :form_params => form_params,
77
91
  :body => post_body,
78
92
  :auth_names => auth_names,
79
- :return_type => 'LocalizationRead')
93
+ :return_type => return_type
94
+ )
95
+
96
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
80
97
  if @api_client.config.debugging
81
- @api_client.config.logger.debug "API called: LocalizationsApi#localizations_localization_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ @api_client.config.logger.debug "API called: LocalizationsApi#get_localization_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
82
99
  end
83
100
  return data, status_code, headers
84
101
  end
@@ -1,16 +1,16 @@
1
1
  =begin
2
2
  #Dyspatch API
3
3
 
4
- ## Introduction The Dyspatch API is based on the REST paradigm and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for the following languages and web frameworks: - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
13
- require 'uri'
13
+ require 'cgi'
14
14
 
15
15
  module DyspatchClient
16
16
  class TemplatesApi
@@ -19,115 +19,149 @@ module DyspatchClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
- # List Templates
23
- # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
22
+ # Get Template by ID
23
+ # Gets a template object with the matching ID. If the template has published content the \"compiled\" field will contain the template .
24
+ # @param template_id [String] A template ID
25
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
26
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2019.10\&quot;, set the value to \&quot;application/vnd.dyspatch.2019.10+json\&quot;
24
27
  # @param [Hash] opts the optional parameters
25
- # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
26
- # @return [TemplatesRead]
27
- def templates_get(opts = {})
28
- data, _status_code, _headers = templates_get_with_http_info(opts)
28
+ # @return [TemplateRead]
29
+ def get_template_by_id(template_id, target_language, accept, opts = {})
30
+ data, _status_code, _headers = get_template_by_id_with_http_info(template_id, target_language, accept, opts)
29
31
  data
30
32
  end
31
33
 
32
- # List Templates
33
- # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
34
+ # Get Template by ID
35
+ # Gets a template object with the matching ID. If the template has published content the \&quot;compiled\&quot; field will contain the template .
36
+ # @param template_id [String] A template ID
37
+ # @param target_language [String] The type of templating language to compile as. Should only be used for visual templates.
38
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2019.10\&quot;, set the value to \&quot;application/vnd.dyspatch.2019.10+json\&quot;
34
39
  # @param [Hash] opts the optional parameters
35
- # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
36
- # @return [Array<(TemplatesRead, Fixnum, Hash)>] TemplatesRead data, response status code and response headers
37
- def templates_get_with_http_info(opts = {})
40
+ # @return [Array<(TemplateRead, Integer, Hash)>] TemplateRead data, response status code and response headers
41
+ def get_template_by_id_with_http_info(template_id, target_language, accept, opts = {})
38
42
  if @api_client.config.debugging
39
- @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_get ...'
43
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.get_template_by_id ...'
44
+ end
45
+ # verify the required parameter 'template_id' is set
46
+ if @api_client.config.client_side_validation && template_id.nil?
47
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.get_template_by_id"
48
+ end
49
+ # verify the required parameter 'target_language' is set
50
+ if @api_client.config.client_side_validation && target_language.nil?
51
+ fail ArgumentError, "Missing the required parameter 'target_language' when calling TemplatesApi.get_template_by_id"
52
+ end
53
+ # verify enum value
54
+ allowable_values = ["html", "handlebars", "ampscript", "freemarker", "cheetah"]
55
+ if @api_client.config.client_side_validation && !allowable_values.include?(target_language)
56
+ fail ArgumentError, "invalid value for \"target_language\", must be one of #{allowable_values}"
57
+ end
58
+ # verify the required parameter 'accept' is set
59
+ if @api_client.config.client_side_validation && accept.nil?
60
+ fail ArgumentError, "Missing the required parameter 'accept' when calling TemplatesApi.get_template_by_id"
40
61
  end
41
62
  # resource path
42
- local_var_path = '/templates'
63
+ local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', CGI.escape(template_id.to_s))
43
64
 
44
65
  # query parameters
45
- query_params = {}
46
- query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
66
+ query_params = opts[:query_params] || {}
67
+ query_params[:'targetLanguage'] = target_language
47
68
 
48
69
  # header parameters
49
- header_params = {}
70
+ header_params = opts[:header_params] || {}
50
71
  # HTTP header 'Accept' (if needed)
51
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
72
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json', '*/*'])
73
+ header_params[:'Accept'] = accept
52
74
 
53
75
  # form parameters
54
- form_params = {}
76
+ form_params = opts[:form_params] || {}
55
77
 
56
78
  # http body (model)
57
- post_body = nil
58
- auth_names = ['Bearer']
59
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
79
+ post_body = opts[:body]
80
+
81
+ # return_type
82
+ return_type = opts[:return_type] || 'TemplateRead'
83
+
84
+ # auth_names
85
+ auth_names = opts[:auth_names] || ['Bearer']
86
+
87
+ new_options = opts.merge(
60
88
  :header_params => header_params,
61
89
  :query_params => query_params,
62
90
  :form_params => form_params,
63
91
  :body => post_body,
64
92
  :auth_names => auth_names,
65
- :return_type => 'TemplatesRead')
93
+ :return_type => return_type
94
+ )
95
+
96
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
66
97
  if @api_client.config.debugging
67
- @api_client.config.logger.debug "API called: TemplatesApi#templates_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
98
+ @api_client.config.logger.debug "API called: TemplatesApi#get_template_by_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
68
99
  end
69
100
  return data, status_code, headers
70
101
  end
71
- # Get Template by ID
72
- # Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
73
- # @param template_id A template ID
74
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
102
+
103
+ # List Templates
104
+ # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
105
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2019.10\&quot;, set the value to \&quot;application/vnd.dyspatch.2019.10+json\&quot;
75
106
  # @param [Hash] opts the optional parameters
76
- # @return [TemplateRead]
77
- def templates_template_id_get(template_id, target_language, opts = {})
78
- data, _status_code, _headers = templates_template_id_get_with_http_info(template_id, target_language, opts)
107
+ # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
108
+ # @return [TemplatesRead]
109
+ def get_templates(accept, opts = {})
110
+ data, _status_code, _headers = get_templates_with_http_info(accept, opts)
79
111
  data
80
112
  end
81
113
 
82
- # Get Template by ID
83
- # Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
84
- # @param template_id A template ID
85
- # @param target_language The type of templating language to compile as. Should only be used for visual templates.
114
+ # List Templates
115
+ # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
116
+ # @param accept [String] A version of the API that should be used for the request. For example, to use version \&quot;2019.10\&quot;, set the value to \&quot;application/vnd.dyspatch.2019.10+json\&quot;
86
117
  # @param [Hash] opts the optional parameters
87
- # @return [Array<(TemplateRead, Fixnum, Hash)>] TemplateRead data, response status code and response headers
88
- def templates_template_id_get_with_http_info(template_id, target_language, opts = {})
118
+ # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
119
+ # @return [Array<(TemplatesRead, Integer, Hash)>] TemplatesRead data, response status code and response headers
120
+ def get_templates_with_http_info(accept, opts = {})
89
121
  if @api_client.config.debugging
90
- @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_template_id_get ...'
122
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.get_templates ...'
91
123
  end
92
- # verify the required parameter 'template_id' is set
93
- if @api_client.config.client_side_validation && template_id.nil?
94
- fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.templates_template_id_get"
95
- end
96
- # verify the required parameter 'target_language' is set
97
- if @api_client.config.client_side_validation && target_language.nil?
98
- fail ArgumentError, "Missing the required parameter 'target_language' when calling TemplatesApi.templates_template_id_get"
99
- end
100
- # verify enum value
101
- if @api_client.config.client_side_validation && !['html', 'jinja', 'handlebars', 'ampscript', 'freemarker', 'cheetah'].include?(target_language)
102
- fail ArgumentError, "invalid value for 'target_language', must be one of html, jinja, handlebars, ampscript, freemarker, cheetah"
124
+ # verify the required parameter 'accept' is set
125
+ if @api_client.config.client_side_validation && accept.nil?
126
+ fail ArgumentError, "Missing the required parameter 'accept' when calling TemplatesApi.get_templates"
103
127
  end
104
128
  # resource path
105
- local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', template_id.to_s)
129
+ local_var_path = '/templates'
106
130
 
107
131
  # query parameters
108
- query_params = {}
109
- query_params[:'targetLanguage'] = target_language
132
+ query_params = opts[:query_params] || {}
133
+ query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
110
134
 
111
135
  # header parameters
112
- header_params = {}
136
+ header_params = opts[:header_params] || {}
113
137
  # HTTP header 'Accept' (if needed)
114
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
138
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json', '*/*'])
139
+ header_params[:'Accept'] = accept
115
140
 
116
141
  # form parameters
117
- form_params = {}
142
+ form_params = opts[:form_params] || {}
118
143
 
119
144
  # http body (model)
120
- post_body = nil
121
- auth_names = ['Bearer']
122
- data, status_code, headers = @api_client.call_api(:GET, local_var_path,
145
+ post_body = opts[:body]
146
+
147
+ # return_type
148
+ return_type = opts[:return_type] || 'TemplatesRead'
149
+
150
+ # auth_names
151
+ auth_names = opts[:auth_names] || ['Bearer']
152
+
153
+ new_options = opts.merge(
123
154
  :header_params => header_params,
124
155
  :query_params => query_params,
125
156
  :form_params => form_params,
126
157
  :body => post_body,
127
158
  :auth_names => auth_names,
128
- :return_type => 'TemplateRead')
159
+ :return_type => return_type
160
+ )
161
+
162
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
129
163
  if @api_client.config.debugging
130
- @api_client.config.logger.debug "API called: TemplatesApi#templates_template_id_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
164
+ @api_client.config.logger.debug "API called: TemplatesApi#get_templates\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
131
165
  end
132
166
  return data, status_code, headers
133
167
  end
@@ -1,12 +1,12 @@
1
1
  =begin
2
2
  #Dyspatch API
3
3
 
4
- ## Introduction The Dyspatch API is based on the REST paradigm and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for the following languages and web frameworks: - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
4
+ ## Introduction The Dyspatch API is based on the REST paradigm, and features resource based URLs with standard HTTP response codes to indicate errors. We use standard HTTP authentication and request verbs, and all responses are JSON formatted. See our [Implementation Guide](https://docs.dyspatch.io/development/implementing_dyspatch/) for more details on how to implement Dyspatch. ## API Client Libraries Dyspatch provides API Clients for popular languages and web frameworks. - [Java](https://github.com/getdyspatch/dyspatch-java) - [Javascript](https://github.com/getdyspatch/dyspatch-javascript) - [Python](https://github.com/getdyspatch/dyspatch-python) - [C#](https://github.com/getdyspatch/dyspatch-dotnet) - [Go](https://github.com/getdyspatch/dyspatch-golang) - [Ruby](https://github.com/getdyspatch/dyspatch-ruby)
5
5
 
6
- OpenAPI spec version: 2019.10
6
+ The version of the OpenAPI document: 2019.10
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.10
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.2.3-SNAPSHOT
10
10
 
11
11
  =end
12
12
 
@@ -15,7 +15,6 @@ require 'json'
15
15
  require 'logger'
16
16
  require 'tempfile'
17
17
  require 'typhoeus'
18
- require 'uri'
19
18
 
20
19
  module DyspatchClient
21
20
  class ApiClient
@@ -31,7 +30,7 @@ module DyspatchClient
31
30
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
32
31
  def initialize(config = Configuration.default)
33
32
  @config = config
34
- @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
33
+ @user_agent = "OpenAPI-Generator/#{VERSION}/ruby"
35
34
  @default_headers = {
36
35
  'Content-Type' => 'application/json',
37
36
  'User-Agent' => @user_agent
@@ -44,7 +43,7 @@ module DyspatchClient
44
43
 
45
44
  # Call an API with given options.
46
45
  #
47
- # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
46
+ # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
48
47
  # the data deserialized from response body (could be nil), response status code and response headers.
49
48
  def call_api(http_method, path, opts = {})
50
49
  request = build_request(http_method, path, opts)
@@ -128,6 +127,34 @@ module DyspatchClient
128
127
  request
129
128
  end
130
129
 
130
+ # Builds the HTTP request body
131
+ #
132
+ # @param [Hash] header_params Header parameters
133
+ # @param [Hash] form_params Query parameters
134
+ # @param [Object] body HTTP body (JSON/XML)
135
+ # @return [String] HTTP body data in the form of string
136
+ def build_request_body(header_params, form_params, body)
137
+ # http form
138
+ if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
139
+ header_params['Content-Type'] == 'multipart/form-data'
140
+ data = {}
141
+ form_params.each do |key, value|
142
+ case value
143
+ when ::File, ::Array, nil
144
+ # let typhoeus handle File, Array and nil parameters
145
+ data[key] = value
146
+ else
147
+ data[key] = value.to_s
148
+ end
149
+ end
150
+ elsif body
151
+ data = body.is_a?(String) ? body : body.to_json
152
+ else
153
+ data = nil
154
+ end
155
+ data
156
+ end
157
+
131
158
  # Check if the given MIME is a JSON MIME.
132
159
  # JSON MIME examples:
133
160
  # application/json
@@ -143,7 +170,7 @@ module DyspatchClient
143
170
  # Deserialize the response to the given return type.
144
171
  #
145
172
  # @param [Response] response HTTP response
146
- # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
173
+ # @param [String] return_type some examples: "User", "Array<User>", "Hash<String, Integer>"
147
174
  def deserialize(response, return_type)
148
175
  body = response.body
149
176
 
@@ -187,7 +214,7 @@ module DyspatchClient
187
214
  data.to_i
188
215
  when 'Float'
189
216
  data.to_f
190
- when 'BOOLEAN'
217
+ when 'Boolean'
191
218
  data == true
192
219
  when 'DateTime'
193
220
  # parse date time (expecting ISO 8601 format)
@@ -210,9 +237,7 @@ module DyspatchClient
210
237
  end
211
238
  else
212
239
  # models, e.g. Pet
213
- DyspatchClient.const_get(return_type).new.tap do |model|
214
- model.build_from_hash data
215
- end
240
+ DyspatchClient.const_get(return_type).build_from_hash(data)
216
241
  end
217
242
  end
218
243
 
@@ -244,7 +269,7 @@ module DyspatchClient
244
269
  tempfile.write(chunk)
245
270
  end
246
271
  request.on_complete do |response|
247
- tempfile.close
272
+ tempfile.close if tempfile
248
273
  @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
249
274
  "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
250
275
  "will be deleted automatically with GC. It's also recommended to delete the temp file "\
@@ -264,35 +289,7 @@ module DyspatchClient
264
289
  def build_request_url(path)
265
290
  # Add leading and trailing slashes to path
266
291
  path = "/#{path}".gsub(/\/+/, '/')
267
- URI.encode(@config.base_url + path)
268
- end
269
-
270
- # Builds the HTTP request body
271
- #
272
- # @param [Hash] header_params Header parameters
273
- # @param [Hash] form_params Query parameters
274
- # @param [Object] body HTTP body (JSON/XML)
275
- # @return [String] HTTP body data in the form of string
276
- def build_request_body(header_params, form_params, body)
277
- # http form
278
- if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
279
- header_params['Content-Type'] == 'multipart/form-data'
280
- data = {}
281
- form_params.each do |key, value|
282
- case value
283
- when ::File, ::Array, nil
284
- # let typhoeus handle File, Array and nil parameters
285
- data[key] = value
286
- else
287
- data[key] = value.to_s
288
- end
289
- end
290
- elsif body
291
- data = body.is_a?(String) ? body : body.to_json
292
- else
293
- data = nil
294
- end
295
- data
292
+ @config.base_url + path
296
293
  end
297
294
 
298
295
  # Update hearder and query params based on authentication settings.
@@ -314,7 +311,7 @@ module DyspatchClient
314
311
 
315
312
  # Sets user agent in HTTP header
316
313
  #
317
- # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
314
+ # @param [String] user_agent User agent (e.g. openapi-generator/ruby/1.0.0)
318
315
  def user_agent=(user_agent)
319
316
  @user_agent = user_agent
320
317
  @default_headers['User-Agent'] = @user_agent