dyspatch_client 2.0.0 → 3.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 (102) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +42 -16
  3. data/docs/APIError.md +1 -1
  4. data/docs/Body.md +8 -0
  5. data/docs/Body1.md +8 -0
  6. data/docs/CreatedAt.md +7 -0
  7. data/docs/DraftDescription.md +7 -0
  8. data/docs/DraftId.md +7 -0
  9. data/docs/DraftMetaRead.md +14 -0
  10. data/docs/DraftName.md +7 -0
  11. data/docs/DraftRead.md +15 -0
  12. data/docs/DraftUrl.md +7 -0
  13. data/docs/DraftsApi.md +467 -0
  14. data/docs/DraftsRead.md +9 -0
  15. data/docs/LanguageId.md +7 -0
  16. data/docs/LocalizationId.md +7 -0
  17. data/docs/LocalizationKeyRead.md +9 -0
  18. data/docs/LocalizationMetaRead.md +1 -0
  19. data/docs/LocalizationName.md +7 -0
  20. data/docs/LocalizationUrl.md +7 -0
  21. data/docs/LocalizationsApi.md +8 -11
  22. data/docs/TemplateDescription.md +7 -0
  23. data/docs/TemplateId.md +7 -0
  24. data/docs/TemplateMetaRead.md +1 -1
  25. data/docs/TemplateName.md +7 -0
  26. data/docs/TemplateRead.md +1 -1
  27. data/docs/TemplateUrl.md +7 -0
  28. data/docs/TemplatesApi.md +9 -14
  29. data/docs/TemplatesRead.md +1 -1
  30. data/docs/UpdatedAt.md +7 -0
  31. data/dyspatch_client.gemspec +8 -8
  32. data/lib/dyspatch_client.rb +24 -3
  33. data/lib/dyspatch_client/api/drafts_api.rb +479 -0
  34. data/lib/dyspatch_client/api/localizations_api.rb +23 -22
  35. data/lib/dyspatch_client/api/templates_api.rb +25 -28
  36. data/lib/dyspatch_client/api_client.rb +11 -11
  37. data/lib/dyspatch_client/api_error.rb +3 -3
  38. data/lib/dyspatch_client/configuration.rb +4 -4
  39. data/lib/dyspatch_client/models/api_error.rb +11 -15
  40. data/lib/dyspatch_client/models/body.rb +183 -0
  41. data/lib/dyspatch_client/models/body_1.rb +183 -0
  42. data/lib/dyspatch_client/models/compiled_read.rb +14 -22
  43. data/lib/dyspatch_client/models/created_at.rb +175 -0
  44. data/lib/dyspatch_client/models/cursor.rb +8 -12
  45. data/lib/dyspatch_client/models/draft_description.rb +175 -0
  46. data/lib/dyspatch_client/models/draft_id.rb +175 -0
  47. data/lib/dyspatch_client/models/draft_meta_read.rb +244 -0
  48. data/lib/dyspatch_client/models/draft_name.rb +175 -0
  49. data/lib/dyspatch_client/models/draft_read.rb +255 -0
  50. data/lib/dyspatch_client/models/draft_url.rb +175 -0
  51. data/lib/dyspatch_client/models/drafts_read.rb +196 -0
  52. data/lib/dyspatch_client/models/language_id.rb +175 -0
  53. data/lib/dyspatch_client/models/localization_id.rb +175 -0
  54. data/lib/dyspatch_client/models/localization_key_read.rb +192 -0
  55. data/lib/dyspatch_client/models/localization_meta_read.rb +20 -15
  56. data/lib/dyspatch_client/models/localization_name.rb +175 -0
  57. data/lib/dyspatch_client/models/localization_read.rb +8 -13
  58. data/lib/dyspatch_client/models/localization_url.rb +175 -0
  59. data/lib/dyspatch_client/models/template_description.rb +175 -0
  60. data/lib/dyspatch_client/models/template_id.rb +175 -0
  61. data/lib/dyspatch_client/models/template_meta_read.rb +8 -13
  62. data/lib/dyspatch_client/models/template_name.rb +175 -0
  63. data/lib/dyspatch_client/models/template_read.rb +8 -13
  64. data/lib/dyspatch_client/models/template_url.rb +175 -0
  65. data/lib/dyspatch_client/models/templates_read.rb +8 -13
  66. data/lib/dyspatch_client/models/updated_at.rb +175 -0
  67. data/lib/dyspatch_client/version.rb +4 -4
  68. data/spec/api/drafts_api_spec.rb +138 -0
  69. data/spec/api/localizations_api_spec.rb +6 -7
  70. data/spec/api/templates_api_spec.rb +6 -8
  71. data/spec/api_client_spec.rb +37 -37
  72. data/spec/configuration_spec.rb +11 -11
  73. data/spec/models/api_error_spec.rb +10 -11
  74. data/spec/models/body_1_spec.rb +41 -0
  75. data/spec/models/body_spec.rb +41 -0
  76. data/spec/models/compiled_read_spec.rb +8 -9
  77. data/spec/models/created_at_spec.rb +35 -0
  78. data/spec/models/cursor_spec.rb +5 -6
  79. data/spec/models/draft_description_spec.rb +35 -0
  80. data/spec/models/draft_id_spec.rb +35 -0
  81. data/spec/models/draft_meta_read_spec.rb +77 -0
  82. data/spec/models/draft_name_spec.rb +35 -0
  83. data/spec/models/draft_read_spec.rb +83 -0
  84. data/spec/models/draft_url_spec.rb +35 -0
  85. data/spec/models/drafts_read_spec.rb +47 -0
  86. data/spec/models/language_id_spec.rb +35 -0
  87. data/spec/models/localization_id_spec.rb +35 -0
  88. data/spec/models/localization_key_read_spec.rb +47 -0
  89. data/spec/models/localization_meta_read_spec.rb +13 -8
  90. data/spec/models/localization_name_spec.rb +35 -0
  91. data/spec/models/localization_read_spec.rb +11 -12
  92. data/spec/models/localization_url_spec.rb +35 -0
  93. data/spec/models/template_description_spec.rb +35 -0
  94. data/spec/models/template_id_spec.rb +35 -0
  95. data/spec/models/template_meta_read_spec.rb +10 -11
  96. data/spec/models/template_name_spec.rb +35 -0
  97. data/spec/models/template_read_spec.rb +11 -12
  98. data/spec/models/template_url_spec.rb +35 -0
  99. data/spec/models/templates_read_spec.rb +5 -6
  100. data/spec/models/updated_at_spec.rb +35 -0
  101. data/spec/spec_helper.rb +3 -3
  102. metadata +106 -22
@@ -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 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)
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)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ OpenAPI spec version: 2019.10
7
7
  Contact: support@dyspatch.io
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: 2.4.9
10
10
 
11
11
  =end
12
12
 
13
- require "uri"
13
+ require 'uri'
14
14
 
15
15
  module DyspatchClient
16
16
  class LocalizationsApi
@@ -19,49 +19,50 @@ module DyspatchClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
-
23
22
  # Get Localization Object by ID
24
- # Returns a specific localization object with a matching ID
23
+ # Returns a specific localization object with a matching ID.
25
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.
26
26
  # @param [Hash] opts the optional parameters
27
- # @option opts [String] :target_language The type of templating language to compile as. Should only be used for visual templates.
28
- # @option opts [String] :accept A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"
29
27
  # @return [LocalizationRead]
30
- def localizations_localization_id_get(localization_id, opts = {})
31
- data, _status_code, _headers = localizations_localization_id_get_with_http_info(localization_id, opts)
32
- return data
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)
30
+ data
33
31
  end
34
32
 
35
33
  # Get Localization Object by ID
36
- # Returns a specific localization object with a matching ID
34
+ # Returns a specific localization object with a matching ID.
37
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.
38
37
  # @param [Hash] opts the optional parameters
39
- # @option opts [String] :target_language The type of templating language to compile as. Should only be used for visual templates.
40
- # @option opts [String] :accept A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"
41
38
  # @return [Array<(LocalizationRead, Fixnum, Hash)>] LocalizationRead data, response status code and response headers
42
- def localizations_localization_id_get_with_http_info(localization_id, opts = {})
39
+ def localizations_localization_id_get_with_http_info(localization_id, target_language, opts = {})
43
40
  if @api_client.config.debugging
44
- @api_client.config.logger.debug "Calling API: LocalizationsApi.localizations_localization_id_get ..."
41
+ @api_client.config.logger.debug 'Calling API: LocalizationsApi.localizations_localization_id_get ...'
45
42
  end
46
43
  # verify the required parameter 'localization_id' is set
47
44
  if @api_client.config.client_side_validation && localization_id.nil?
48
45
  fail ArgumentError, "Missing the required parameter 'localization_id' when calling LocalizationsApi.localizations_localization_id_get"
49
46
  end
50
- if @api_client.config.client_side_validation && opts[:'target_language'] && !['html', 'jinja', 'handlebars', 'ampscript', 'freemarker', 'cheetah'].include?(opts[:'target_language'])
51
- fail ArgumentError, 'invalid value for "target_language", must be one of html, jinja, handlebars, ampscript, freemarker, cheetah'
47
+ # verify the required parameter 'target_language' is set
48
+ 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"
50
+ end
51
+ # 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"
52
54
  end
53
55
  # resource path
54
- local_var_path = "/localizations/{localizationId}".sub('{' + 'localizationId' + '}', localization_id.to_s)
56
+ local_var_path = '/localizations/{localizationId}'.sub('{' + 'localizationId' + '}', localization_id.to_s)
55
57
 
56
58
  # query parameters
57
59
  query_params = {}
58
- query_params[:'targetLanguage'] = opts[:'target_language'] if !opts[:'target_language'].nil?
60
+ query_params[:'targetLanguage'] = target_language
59
61
 
60
62
  # header parameters
61
63
  header_params = {}
62
64
  # HTTP header 'Accept' (if needed)
63
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.03+json'])
64
- header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil?
65
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
65
66
 
66
67
  # form parameters
67
68
  form_params = {}
@@ -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 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)
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)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ OpenAPI spec version: 2019.10
7
7
  Contact: support@dyspatch.io
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: 2.4.9
10
10
 
11
11
  =end
12
12
 
13
- require "uri"
13
+ require 'uri'
14
14
 
15
15
  module DyspatchClient
16
16
  class TemplatesApi
@@ -19,30 +19,27 @@ module DyspatchClient
19
19
  def initialize(api_client = ApiClient.default)
20
20
  @api_client = api_client
21
21
  end
22
-
23
22
  # List Templates
24
23
  # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
25
24
  # @param [Hash] opts the optional parameters
26
25
  # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
27
- # @option opts [String] :accept A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"
28
26
  # @return [TemplatesRead]
29
27
  def templates_get(opts = {})
30
28
  data, _status_code, _headers = templates_get_with_http_info(opts)
31
- return data
29
+ data
32
30
  end
33
31
 
34
32
  # List Templates
35
33
  # Gets a list of Template Metadata objects for all templates. Up to 25 results returned before results are paginated.
36
34
  # @param [Hash] opts the optional parameters
37
35
  # @option opts [String] :cursor A cursor value used to retrieve a specific page from a paginated result set.
38
- # @option opts [String] :accept A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"
39
36
  # @return [Array<(TemplatesRead, Fixnum, Hash)>] TemplatesRead data, response status code and response headers
40
37
  def templates_get_with_http_info(opts = {})
41
38
  if @api_client.config.debugging
42
- @api_client.config.logger.debug "Calling API: TemplatesApi.templates_get ..."
39
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_get ...'
43
40
  end
44
41
  # resource path
45
- local_var_path = "/templates"
42
+ local_var_path = '/templates'
46
43
 
47
44
  # query parameters
48
45
  query_params = {}
@@ -51,8 +48,7 @@ module DyspatchClient
51
48
  # header parameters
52
49
  header_params = {}
53
50
  # HTTP header 'Accept' (if needed)
54
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.03+json'])
55
- header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil?
51
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
56
52
 
57
53
  # form parameters
58
54
  form_params = {}
@@ -72,49 +68,50 @@ module DyspatchClient
72
68
  end
73
69
  return data, status_code, headers
74
70
  end
75
-
76
71
  # Get Template by ID
77
72
  # Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
78
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.
79
75
  # @param [Hash] opts the optional parameters
80
- # @option opts [String] :target_language The type of templating language to compile as. Should only be used for visual templates.
81
- # @option opts [String] :accept A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"
82
76
  # @return [TemplateRead]
83
- def templates_template_id_get(template_id, opts = {})
84
- data, _status_code, _headers = templates_template_id_get_with_http_info(template_id, opts)
85
- return data
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)
79
+ data
86
80
  end
87
81
 
88
82
  # Get Template by ID
89
83
  # Gets a template object with the matching ID. If the template has published content the "compiled" field will contain the template .
90
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.
91
86
  # @param [Hash] opts the optional parameters
92
- # @option opts [String] :target_language The type of templating language to compile as. Should only be used for visual templates.
93
- # @option opts [String] :accept A version of the API that should be used for the request. For example, to use version "2019.03", set the value to "application/vnd.dyspatch.2019.03+json"
94
87
  # @return [Array<(TemplateRead, Fixnum, Hash)>] TemplateRead data, response status code and response headers
95
- def templates_template_id_get_with_http_info(template_id, opts = {})
88
+ def templates_template_id_get_with_http_info(template_id, target_language, opts = {})
96
89
  if @api_client.config.debugging
97
- @api_client.config.logger.debug "Calling API: TemplatesApi.templates_template_id_get ..."
90
+ @api_client.config.logger.debug 'Calling API: TemplatesApi.templates_template_id_get ...'
98
91
  end
99
92
  # verify the required parameter 'template_id' is set
100
93
  if @api_client.config.client_side_validation && template_id.nil?
101
94
  fail ArgumentError, "Missing the required parameter 'template_id' when calling TemplatesApi.templates_template_id_get"
102
95
  end
103
- if @api_client.config.client_side_validation && opts[:'target_language'] && !['html', 'jinja', 'handlebars', 'ampscript', 'freemarker', 'cheetah'].include?(opts[:'target_language'])
104
- fail ArgumentError, 'invalid value for "target_language", must be one of html, jinja, handlebars, ampscript, freemarker, cheetah'
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"
105
103
  end
106
104
  # resource path
107
- local_var_path = "/templates/{templateId}".sub('{' + 'templateId' + '}', template_id.to_s)
105
+ local_var_path = '/templates/{templateId}'.sub('{' + 'templateId' + '}', template_id.to_s)
108
106
 
109
107
  # query parameters
110
108
  query_params = {}
111
- query_params[:'targetLanguage'] = opts[:'target_language'] if !opts[:'target_language'].nil?
109
+ query_params[:'targetLanguage'] = target_language
112
110
 
113
111
  # header parameters
114
112
  header_params = {}
115
113
  # HTTP header 'Accept' (if needed)
116
- header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.03+json'])
117
- header_params[:'Accept'] = opts[:'accept'] if !opts[:'accept'].nil?
114
+ header_params['Accept'] = @api_client.select_header_accept(['application/vnd.dyspatch.2019.10+json'])
118
115
 
119
116
  # form parameters
120
117
  form_params = {}
@@ -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 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)
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)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ OpenAPI spec version: 2019.10
7
7
  Contact: support@dyspatch.io
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: 2.4.9
10
10
 
11
11
  =end
12
12
 
@@ -33,7 +33,7 @@ module DyspatchClient
33
33
  @config = config
34
34
  @user_agent = "Swagger-Codegen/#{VERSION}/ruby"
35
35
  @default_headers = {
36
- 'Content-Type' => "application/json",
36
+ 'Content-Type' => 'application/json',
37
37
  'User-Agent' => @user_agent
38
38
  }
39
39
  end
@@ -137,7 +137,7 @@ module DyspatchClient
137
137
  # @param [String] mime MIME
138
138
  # @return [Boolean] True if the MIME is application/json
139
139
  def json_mime?(mime)
140
- (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
140
+ (mime == '*/*') || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
141
141
  end
142
142
 
143
143
  # Deserialize the response to the given return type.
@@ -201,12 +201,12 @@ module DyspatchClient
201
201
  when /\AArray<(.+)>\z/
202
202
  # e.g. Array<Pet>
203
203
  sub_type = $1
204
- data.map {|item| convert_to_type(item, sub_type) }
204
+ data.map { |item| convert_to_type(item, sub_type) }
205
205
  when /\AHash\<String, (.+)\>\z/
206
206
  # e.g. Hash<String, Integer>
207
207
  sub_type = $1
208
208
  {}.tap do |hash|
209
- data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
209
+ data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
210
210
  end
211
211
  else
212
212
  # models, e.g. Pet
@@ -228,7 +228,7 @@ module DyspatchClient
228
228
  encoding = nil
229
229
  request.on_headers do |response|
230
230
  content_disposition = response.headers['Content-Disposition']
231
- if content_disposition and content_disposition =~ /filename=/i
231
+ if content_disposition && content_disposition =~ /filename=/i
232
232
  filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
233
233
  prefix = sanitize_filename(filename)
234
234
  else
@@ -327,7 +327,7 @@ module DyspatchClient
327
327
  return nil if accepts.nil? || accepts.empty?
328
328
  # use JSON when present, otherwise use all of the provided
329
329
  json_accept = accepts.find { |s| json_mime?(s) }
330
- return json_accept || accepts.join(',')
330
+ json_accept || accepts.join(',')
331
331
  end
332
332
 
333
333
  # Return Content-Type header based on an array of content types provided.
@@ -338,7 +338,7 @@ module DyspatchClient
338
338
  return 'application/json' if content_types.nil? || content_types.empty?
339
339
  # use JSON when present, otherwise use the first one
340
340
  json_content_type = content_types.find { |s| json_mime?(s) }
341
- return json_content_type || content_types.first
341
+ json_content_type || content_types.first
342
342
  end
343
343
 
344
344
  # Convert object (array, hash, object, etc) to JSON string.
@@ -348,7 +348,7 @@ module DyspatchClient
348
348
  return model if model.nil? || model.is_a?(String)
349
349
  local_body = nil
350
350
  if model.is_a?(Array)
351
- local_body = model.map{|m| object_to_hash(m) }
351
+ local_body = model.map { |m| object_to_hash(m) }
352
352
  else
353
353
  local_body = object_to_hash(model)
354
354
  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 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)
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)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ OpenAPI spec version: 2019.10
7
7
  Contact: support@dyspatch.io
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: 2.4.9
10
10
 
11
11
  =end
12
12
 
@@ -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 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)
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)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ OpenAPI spec version: 2019.10
7
7
  Contact: support@dyspatch.io
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: 2.4.9
10
10
 
11
11
  =end
12
12
 
@@ -170,7 +170,7 @@ module DyspatchClient
170
170
  def base_path=(base_path)
171
171
  # Add leading and trailing slashes to base_path
172
172
  @base_path = "/#{base_path}".gsub(/\/+/, '/')
173
- @base_path = "" if @base_path == "/"
173
+ @base_path = '' if @base_path == '/'
174
174
  end
175
175
 
176
176
  def base_url
@@ -1,19 +1,18 @@
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 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)
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)
5
5
 
6
- OpenAPI spec version: 2019.03
6
+ OpenAPI spec version: 2019.10
7
7
  Contact: support@dyspatch.io
8
8
  Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.3.1
9
+ Swagger Codegen version: 2.4.9
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
-
17
16
  class APIError
18
17
  # Error code: * server_error - Internal server error. * invalid_parameter - Validation error, parameter will contain invalid field and message will contain the reason. * invalid_body - Body could not be parsed, message will contain the reason. * invalid_request - Validation error, the protocol used to make the request was not https. * unauthorized - Credentials were found but permissions were not sufficient. * unauthenticated - Credentials were not found or were not valid. * not_found - The requested resource was not found. * rate_limited - The request was refused because a rate limit was exceeded. There is an account wide rate limit of 3600 requests per-minute, although that is subject to change. The current remaining rate limit can be viewed by checking the X-Ratelimit-Remaining header.
19
18
  attr_accessor :code
@@ -70,7 +69,7 @@ module DyspatchClient
70
69
  return unless attributes.is_a?(Hash)
71
70
 
72
71
  # convert string to symbol for hash key
73
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
72
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
74
73
 
75
74
  if attributes.has_key?(:'code')
76
75
  self.code = attributes[:'code']
@@ -83,30 +82,29 @@ module DyspatchClient
83
82
  if attributes.has_key?(:'parameter')
84
83
  self.parameter = attributes[:'parameter']
85
84
  end
86
-
87
85
  end
88
86
 
89
87
  # Show invalid properties with the reasons. Usually used together with valid?
90
88
  # @return Array for valid properties with the reasons
91
89
  def list_invalid_properties
92
90
  invalid_properties = Array.new
93
- return invalid_properties
91
+ invalid_properties
94
92
  end
95
93
 
96
94
  # Check to see if the all the properties in the model are valid
97
95
  # @return true if the model is valid
98
96
  def valid?
99
- code_validator = EnumAttributeValidator.new('String', ["server_error", "invalid_parameter", "invalid_body", "invalid_request", "unauthorized", "unauthenticated", "not_found", "rate_limited"])
97
+ code_validator = EnumAttributeValidator.new('String', ['server_error', 'invalid_parameter', 'invalid_body', 'invalid_request', 'unauthorized', 'unauthenticated', 'not_found', 'rate_limited'])
100
98
  return false unless code_validator.valid?(@code)
101
- return true
99
+ true
102
100
  end
103
101
 
104
102
  # Custom attribute writer method checking allowed values (enum).
105
103
  # @param [Object] code Object to be assigned
106
104
  def code=(code)
107
- validator = EnumAttributeValidator.new('String', ["server_error", "invalid_parameter", "invalid_body", "invalid_request", "unauthorized", "unauthenticated", "not_found", "rate_limited"])
105
+ validator = EnumAttributeValidator.new('String', ['server_error', 'invalid_parameter', 'invalid_body', 'invalid_request', 'unauthorized', 'unauthenticated', 'not_found', 'rate_limited'])
108
106
  unless validator.valid?(code)
109
- fail ArgumentError, "invalid value for 'code', must be one of #{validator.allowable_values}."
107
+ fail ArgumentError, 'invalid value for "code", must be one of #{validator.allowable_values}.'
110
108
  end
111
109
  @code = code
112
110
  end
@@ -143,7 +141,7 @@ module DyspatchClient
143
141
  # check to ensure the input is an array given that the the attribute
144
142
  # is documented as an array but the input is not
145
143
  if attributes[self.class.attribute_map[key]].is_a?(Array)
146
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
144
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
147
145
  end
148
146
  elsif !attributes[self.class.attribute_map[key]].nil?
149
147
  self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
@@ -225,7 +223,7 @@ module DyspatchClient
225
223
  # @return [Hash] Returns the value in the form of hash
226
224
  def _to_hash(value)
227
225
  if value.is_a?(Array)
228
- value.compact.map{ |v| _to_hash(v) }
226
+ value.compact.map { |v| _to_hash(v) }
229
227
  elsif value.is_a?(Hash)
230
228
  {}.tap do |hash|
231
229
  value.each { |k, v| hash[k] = _to_hash(v) }
@@ -236,7 +234,5 @@ module DyspatchClient
236
234
  value
237
235
  end
238
236
  end
239
-
240
237
  end
241
-
242
238
  end
@@ -0,0 +1,183 @@
1
+ =begin
2
+ #Dyspatch API
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)
5
+
6
+ OpenAPI spec version: 2019.10
7
+ Contact: support@dyspatch.io
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.9
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DyspatchClient
16
+ class Body
17
+ attr_accessor :name
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'name' => :'name'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'name' => :'String'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'name')
42
+ self.name = attributes[:'name']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ invalid_properties
51
+ end
52
+
53
+ # Check to see if the all the properties in the model are valid
54
+ # @return true if the model is valid
55
+ def valid?
56
+ true
57
+ end
58
+
59
+ # Checks equality by comparing each attribute.
60
+ # @param [Object] Object to be compared
61
+ def ==(o)
62
+ return true if self.equal?(o)
63
+ self.class == o.class &&
64
+ name == o.name
65
+ end
66
+
67
+ # @see the `==` method
68
+ # @param [Object] Object to be compared
69
+ def eql?(o)
70
+ self == o
71
+ end
72
+
73
+ # Calculates hash code according to all attributes.
74
+ # @return [Fixnum] Hash code
75
+ def hash
76
+ [name].hash
77
+ end
78
+
79
+ # Builds the object from hash
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ # @return [Object] Returns the model itself
82
+ def build_from_hash(attributes)
83
+ return nil unless attributes.is_a?(Hash)
84
+ self.class.swagger_types.each_pair do |key, type|
85
+ if type =~ /\AArray<(.*)>/i
86
+ # check to ensure the input is an array given that the the attribute
87
+ # is documented as an array but the input is not
88
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
89
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
90
+ end
91
+ elsif !attributes[self.class.attribute_map[key]].nil?
92
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
93
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
94
+ end
95
+
96
+ self
97
+ end
98
+
99
+ # Deserializes the data based on type
100
+ # @param string type Data type
101
+ # @param string value Value to be deserialized
102
+ # @return [Object] Deserialized data
103
+ def _deserialize(type, value)
104
+ case type.to_sym
105
+ when :DateTime
106
+ DateTime.parse(value)
107
+ when :Date
108
+ Date.parse(value)
109
+ when :String
110
+ value.to_s
111
+ when :Integer
112
+ value.to_i
113
+ when :Float
114
+ value.to_f
115
+ when :BOOLEAN
116
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
117
+ true
118
+ else
119
+ false
120
+ end
121
+ when :Object
122
+ # generic object (usually a Hash), return directly
123
+ value
124
+ when /\AArray<(?<inner_type>.+)>\z/
125
+ inner_type = Regexp.last_match[:inner_type]
126
+ value.map { |v| _deserialize(inner_type, v) }
127
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
128
+ k_type = Regexp.last_match[:k_type]
129
+ v_type = Regexp.last_match[:v_type]
130
+ {}.tap do |hash|
131
+ value.each do |k, v|
132
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
133
+ end
134
+ end
135
+ else # model
136
+ temp_model = DyspatchClient.const_get(type).new
137
+ temp_model.build_from_hash(value)
138
+ end
139
+ end
140
+
141
+ # Returns the string representation of the object
142
+ # @return [String] String presentation of the object
143
+ def to_s
144
+ to_hash.to_s
145
+ end
146
+
147
+ # to_body is an alias to to_hash (backward compatibility)
148
+ # @return [Hash] Returns the object in the form of hash
149
+ def to_body
150
+ to_hash
151
+ end
152
+
153
+ # Returns the object in the form of hash
154
+ # @return [Hash] Returns the object in the form of hash
155
+ def to_hash
156
+ hash = {}
157
+ self.class.attribute_map.each_pair do |attr, param|
158
+ value = self.send(attr)
159
+ next if value.nil?
160
+ hash[param] = _to_hash(value)
161
+ end
162
+ hash
163
+ end
164
+
165
+ # Outputs non-array value in the form of hash
166
+ # For object, use to_hash. Otherwise, just return the value
167
+ # @param [Object] value Any valid value
168
+ # @return [Hash] Returns the value in the form of hash
169
+ def _to_hash(value)
170
+ if value.is_a?(Array)
171
+ value.compact.map { |v| _to_hash(v) }
172
+ elsif value.is_a?(Hash)
173
+ {}.tap do |hash|
174
+ value.each { |k, v| hash[k] = _to_hash(v) }
175
+ end
176
+ elsif value.respond_to? :to_hash
177
+ value.to_hash
178
+ else
179
+ value
180
+ end
181
+ end
182
+ end
183
+ end