dyspatch_client 3.0.0 → 6.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 (109) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/README.md +45 -53
  4. data/Rakefile +2 -0
  5. data/docs/APIError.md +13 -2
  6. data/docs/CompiledRead.md +15 -0
  7. data/docs/Cursor.md +11 -1
  8. data/docs/DraftMetaRead.md +14 -1
  9. data/docs/DraftRead.md +17 -1
  10. data/docs/DraftsApi.md +140 -131
  11. data/docs/DraftsRead.md +12 -2
  12. data/docs/{Body.md → InlineObject.md} +10 -1
  13. data/docs/LocalizationKeyRead.md +10 -0
  14. data/docs/LocalizationMetaRead.md +15 -2
  15. data/docs/LocalizationRead.md +19 -1
  16. data/docs/LocalizationsApi.md +75 -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 -20
  23. data/lib/dyspatch_client/api/drafts_api.rb +375 -234
  24. data/lib/dyspatch_client/api/localizations_api.rb +135 -31
  25. data/lib/dyspatch_client/api/templates_api.rb +99 -65
  26. data/lib/dyspatch_client/api_client.rb +46 -47
  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 +56 -67
  31. data/lib/dyspatch_client/models/cursor.rb +43 -20
  32. data/lib/dyspatch_client/models/draft_meta_read.rb +49 -35
  33. data/lib/dyspatch_client/models/draft_read.rb +49 -25
  34. data/lib/dyspatch_client/models/drafts_read.rb +42 -19
  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 +62 -36
  38. data/lib/dyspatch_client/models/localization_read.rb +71 -35
  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 +26 -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 +4 -4
  48. data/spec/spec_helper.rb +4 -4
  49. metadata +11 -219
  50. data/LICENSE +0 -202
  51. data/docs/Body1.md +0 -8
  52. data/docs/CreatedAt.md +0 -7
  53. data/docs/DraftDescription.md +0 -7
  54. data/docs/DraftId.md +0 -7
  55. data/docs/DraftName.md +0 -7
  56. data/docs/DraftUrl.md +0 -7
  57. data/docs/LanguageId.md +0 -7
  58. data/docs/LocalizationId.md +0 -7
  59. data/docs/LocalizationName.md +0 -7
  60. data/docs/LocalizationUrl.md +0 -7
  61. data/docs/TemplateDescription.md +0 -7
  62. data/docs/TemplateId.md +0 -7
  63. data/docs/TemplateName.md +0 -7
  64. data/docs/TemplateUrl.md +0 -7
  65. data/docs/UpdatedAt.md +0 -7
  66. data/git_push.sh +0 -55
  67. data/lib/dyspatch_client/models/body_1.rb +0 -183
  68. data/lib/dyspatch_client/models/created_at.rb +0 -175
  69. data/lib/dyspatch_client/models/draft_description.rb +0 -175
  70. data/lib/dyspatch_client/models/draft_id.rb +0 -175
  71. data/lib/dyspatch_client/models/draft_name.rb +0 -175
  72. data/lib/dyspatch_client/models/draft_url.rb +0 -175
  73. data/lib/dyspatch_client/models/language_id.rb +0 -175
  74. data/lib/dyspatch_client/models/localization_id.rb +0 -175
  75. data/lib/dyspatch_client/models/localization_name.rb +0 -175
  76. data/lib/dyspatch_client/models/localization_url.rb +0 -175
  77. data/lib/dyspatch_client/models/template_description.rb +0 -175
  78. data/lib/dyspatch_client/models/template_id.rb +0 -175
  79. data/lib/dyspatch_client/models/template_name.rb +0 -175
  80. data/lib/dyspatch_client/models/template_url.rb +0 -175
  81. data/lib/dyspatch_client/models/updated_at.rb +0 -175
  82. data/spec/models/api_error_spec.rb +0 -57
  83. data/spec/models/body_1_spec.rb +0 -41
  84. data/spec/models/body_spec.rb +0 -41
  85. data/spec/models/compiled_read_spec.rb +0 -65
  86. data/spec/models/created_at_spec.rb +0 -35
  87. data/spec/models/cursor_spec.rb +0 -47
  88. data/spec/models/draft_description_spec.rb +0 -35
  89. data/spec/models/draft_id_spec.rb +0 -35
  90. data/spec/models/draft_meta_read_spec.rb +0 -77
  91. data/spec/models/draft_name_spec.rb +0 -35
  92. data/spec/models/draft_read_spec.rb +0 -83
  93. data/spec/models/draft_url_spec.rb +0 -35
  94. data/spec/models/drafts_read_spec.rb +0 -47
  95. data/spec/models/language_id_spec.rb +0 -35
  96. data/spec/models/localization_id_spec.rb +0 -35
  97. data/spec/models/localization_key_read_spec.rb +0 -47
  98. data/spec/models/localization_meta_read_spec.rb +0 -65
  99. data/spec/models/localization_name_spec.rb +0 -35
  100. data/spec/models/localization_read_spec.rb +0 -83
  101. data/spec/models/localization_url_spec.rb +0 -35
  102. data/spec/models/template_description_spec.rb +0 -35
  103. data/spec/models/template_id_spec.rb +0 -35
  104. data/spec/models/template_meta_read_spec.rb +0 -77
  105. data/spec/models/template_name_spec.rb +0 -35
  106. data/spec/models/template_read_spec.rb +0 -83
  107. data/spec/models/template_url_spec.rb +0 -35
  108. data/spec/models/templates_read_spec.rb +0 -47
  109. data/spec/models/updated_at_spec.rb +0 -35
@@ -1,82 +1,98 @@
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: 2020.11
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.9
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
+ # localization metadata
16
17
  class LocalizationMetaRead
17
18
  # An opaque, unique identifier for a localization
18
19
  attr_accessor :id
19
20
 
20
- # A language identifier comprised of a language and a country identifier. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/).
21
- attr_accessor :language
22
-
23
21
  # The user-specified name of a localization
24
22
  attr_accessor :name
25
23
 
26
24
  # The API url for a specific localization
27
25
  attr_accessor :url
28
26
 
29
- # An opaque, unique identifier for a draft
30
- attr_accessor :draft
27
+ # the locale group this localization belongs to, if this field is empty the localization does not belong to any locale group
28
+ attr_accessor :locale_group
29
+
30
+ # a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes.
31
+ attr_accessor :languages
31
32
 
32
33
  # Attribute mapping from ruby-style variable name to JSON key.
33
34
  def self.attribute_map
34
35
  {
35
36
  :'id' => :'id',
36
- :'language' => :'language',
37
37
  :'name' => :'name',
38
38
  :'url' => :'url',
39
- :'draft' => :'draft'
39
+ :'locale_group' => :'localeGroup',
40
+ :'languages' => :'languages'
40
41
  }
41
42
  end
42
43
 
43
44
  # Attribute type mapping.
44
- def self.swagger_types
45
+ def self.openapi_types
45
46
  {
46
47
  :'id' => :'String',
47
- :'language' => :'String',
48
48
  :'name' => :'String',
49
49
  :'url' => :'String',
50
- :'draft' => :'String'
50
+ :'locale_group' => :'String',
51
+ :'languages' => :'Array<String>'
51
52
  }
52
53
  end
53
54
 
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
54
61
  # Initializes the object
55
62
  # @param [Hash] attributes Model attributes in the form of hash
56
63
  def initialize(attributes = {})
57
- return unless attributes.is_a?(Hash)
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::LocalizationMetaRead` initialize method"
66
+ end
58
67
 
59
- # convert string to symbol for hash key
60
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::LocalizationMetaRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
61
75
 
62
- if attributes.has_key?(:'id')
76
+ if attributes.key?(:'id')
63
77
  self.id = attributes[:'id']
64
78
  end
65
79
 
66
- if attributes.has_key?(:'language')
67
- self.language = attributes[:'language']
68
- end
69
-
70
- if attributes.has_key?(:'name')
80
+ if attributes.key?(:'name')
71
81
  self.name = attributes[:'name']
72
82
  end
73
83
 
74
- if attributes.has_key?(:'url')
84
+ if attributes.key?(:'url')
75
85
  self.url = attributes[:'url']
76
86
  end
77
87
 
78
- if attributes.has_key?(:'draft')
79
- self.draft = attributes[:'draft']
88
+ if attributes.key?(:'locale_group')
89
+ self.locale_group = attributes[:'locale_group']
90
+ end
91
+
92
+ if attributes.key?(:'languages')
93
+ if (value = attributes[:'languages']).is_a?(Array)
94
+ self.languages = value
95
+ end
80
96
  end
81
97
  end
82
98
 
@@ -99,10 +115,10 @@ module DyspatchClient
99
115
  return true if self.equal?(o)
100
116
  self.class == o.class &&
101
117
  id == o.id &&
102
- language == o.language &&
103
118
  name == o.name &&
104
119
  url == o.url &&
105
- draft == o.draft
120
+ locale_group == o.locale_group &&
121
+ languages == o.languages
106
122
  end
107
123
 
108
124
  # @see the `==` method
@@ -112,9 +128,16 @@ module DyspatchClient
112
128
  end
113
129
 
114
130
  # Calculates hash code according to all attributes.
115
- # @return [Fixnum] Hash code
131
+ # @return [Integer] Hash code
116
132
  def hash
117
- [id, language, name, url, draft].hash
133
+ [id, name, url, locale_group, languages].hash
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def self.build_from_hash(attributes)
140
+ new.build_from_hash(attributes)
118
141
  end
119
142
 
120
143
  # Builds the object from hash
@@ -122,9 +145,9 @@ module DyspatchClient
122
145
  # @return [Object] Returns the model itself
123
146
  def build_from_hash(attributes)
124
147
  return nil unless attributes.is_a?(Hash)
125
- self.class.swagger_types.each_pair do |key, type|
148
+ self.class.openapi_types.each_pair do |key, type|
126
149
  if type =~ /\AArray<(.*)>/i
127
- # check to ensure the input is an array given that the the attribute
150
+ # check to ensure the input is an array given that the attribute
128
151
  # is documented as an array but the input is not
129
152
  if attributes[self.class.attribute_map[key]].is_a?(Array)
130
153
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -153,7 +176,7 @@ module DyspatchClient
153
176
  value.to_i
154
177
  when :Float
155
178
  value.to_f
156
- when :BOOLEAN
179
+ when :Boolean
157
180
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
158
181
  true
159
182
  else
@@ -174,8 +197,7 @@ module DyspatchClient
174
197
  end
175
198
  end
176
199
  else # model
177
- temp_model = DyspatchClient.const_get(type).new
178
- temp_model.build_from_hash(value)
200
+ DyspatchClient.const_get(type).build_from_hash(value)
179
201
  end
180
202
  end
181
203
 
@@ -197,7 +219,11 @@ module DyspatchClient
197
219
  hash = {}
198
220
  self.class.attribute_map.each_pair do |attr, param|
199
221
  value = self.send(attr)
200
- next if value.nil?
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
201
227
  hash[param] = _to_hash(value)
202
228
  end
203
229
  hash
@@ -1,24 +1,25 @@
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: 2020.11
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.9
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
+ # localization metadata and latest revision for associated template
16
17
  class LocalizationRead
17
18
  # An opaque, unique identifier for a localization
18
19
  attr_accessor :id
19
20
 
20
- # A language identifier comprised of a language and a country identifier. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/).
21
- attr_accessor :language
21
+ # a list of locale codes that are available in the localization. See [supported languages](https://docs.dyspatch.io/localization/supported_languages/) for an exhaustive list of locale codes.
22
+ attr_accessor :languages
22
23
 
23
24
  # The API url for a specific localization
24
25
  attr_accessor :url
@@ -37,73 +38,97 @@ module DyspatchClient
37
38
  # The user-specified name of a localization
38
39
  attr_accessor :name
39
40
 
41
+ # the locale group this localization belongs to, if this field is empty the localization does not belong to any locale group
42
+ attr_accessor :locale_group
43
+
40
44
  # Attribute mapping from ruby-style variable name to JSON key.
41
45
  def self.attribute_map
42
46
  {
43
47
  :'id' => :'id',
44
- :'language' => :'language',
48
+ :'languages' => :'languages',
45
49
  :'url' => :'url',
46
50
  :'template' => :'template',
47
51
  :'compiled' => :'compiled',
48
52
  :'created_at' => :'createdAt',
49
53
  :'updated_at' => :'updatedAt',
50
- :'name' => :'name'
54
+ :'name' => :'name',
55
+ :'locale_group' => :'localeGroup'
51
56
  }
52
57
  end
53
58
 
54
59
  # Attribute type mapping.
55
- def self.swagger_types
60
+ def self.openapi_types
56
61
  {
57
62
  :'id' => :'String',
58
- :'language' => :'String',
63
+ :'languages' => :'Array<String>',
59
64
  :'url' => :'String',
60
65
  :'template' => :'String',
61
66
  :'compiled' => :'CompiledRead',
62
67
  :'created_at' => :'DateTime',
63
68
  :'updated_at' => :'DateTime',
64
- :'name' => :'String'
69
+ :'name' => :'String',
70
+ :'locale_group' => :'String'
65
71
  }
66
72
  end
67
73
 
74
+ # List of attributes with nullable: true
75
+ def self.openapi_nullable
76
+ Set.new([
77
+ ])
78
+ end
79
+
68
80
  # Initializes the object
69
81
  # @param [Hash] attributes Model attributes in the form of hash
70
82
  def initialize(attributes = {})
71
- return unless attributes.is_a?(Hash)
83
+ if (!attributes.is_a?(Hash))
84
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::LocalizationRead` initialize method"
85
+ end
72
86
 
73
- # convert string to symbol for hash key
74
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
87
+ # check to see if the attribute exists and convert string to symbol for hash key
88
+ attributes = attributes.each_with_object({}) { |(k, v), h|
89
+ if (!self.class.attribute_map.key?(k.to_sym))
90
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::LocalizationRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
91
+ end
92
+ h[k.to_sym] = v
93
+ }
75
94
 
76
- if attributes.has_key?(:'id')
95
+ if attributes.key?(:'id')
77
96
  self.id = attributes[:'id']
78
97
  end
79
98
 
80
- if attributes.has_key?(:'language')
81
- self.language = attributes[:'language']
99
+ if attributes.key?(:'languages')
100
+ if (value = attributes[:'languages']).is_a?(Array)
101
+ self.languages = value
102
+ end
82
103
  end
83
104
 
84
- if attributes.has_key?(:'url')
105
+ if attributes.key?(:'url')
85
106
  self.url = attributes[:'url']
86
107
  end
87
108
 
88
- if attributes.has_key?(:'template')
109
+ if attributes.key?(:'template')
89
110
  self.template = attributes[:'template']
90
111
  end
91
112
 
92
- if attributes.has_key?(:'compiled')
113
+ if attributes.key?(:'compiled')
93
114
  self.compiled = attributes[:'compiled']
94
115
  end
95
116
 
96
- if attributes.has_key?(:'createdAt')
97
- self.created_at = attributes[:'createdAt']
117
+ if attributes.key?(:'created_at')
118
+ self.created_at = attributes[:'created_at']
98
119
  end
99
120
 
100
- if attributes.has_key?(:'updatedAt')
101
- self.updated_at = attributes[:'updatedAt']
121
+ if attributes.key?(:'updated_at')
122
+ self.updated_at = attributes[:'updated_at']
102
123
  end
103
124
 
104
- if attributes.has_key?(:'name')
125
+ if attributes.key?(:'name')
105
126
  self.name = attributes[:'name']
106
127
  end
128
+
129
+ if attributes.key?(:'locale_group')
130
+ self.locale_group = attributes[:'locale_group']
131
+ end
107
132
  end
108
133
 
109
134
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -125,13 +150,14 @@ module DyspatchClient
125
150
  return true if self.equal?(o)
126
151
  self.class == o.class &&
127
152
  id == o.id &&
128
- language == o.language &&
153
+ languages == o.languages &&
129
154
  url == o.url &&
130
155
  template == o.template &&
131
156
  compiled == o.compiled &&
132
157
  created_at == o.created_at &&
133
158
  updated_at == o.updated_at &&
134
- name == o.name
159
+ name == o.name &&
160
+ locale_group == o.locale_group
135
161
  end
136
162
 
137
163
  # @see the `==` method
@@ -141,9 +167,16 @@ module DyspatchClient
141
167
  end
142
168
 
143
169
  # Calculates hash code according to all attributes.
144
- # @return [Fixnum] Hash code
170
+ # @return [Integer] Hash code
145
171
  def hash
146
- [id, language, url, template, compiled, created_at, updated_at, name].hash
172
+ [id, languages, url, template, compiled, created_at, updated_at, name, locale_group].hash
173
+ end
174
+
175
+ # Builds the object from hash
176
+ # @param [Hash] attributes Model attributes in the form of hash
177
+ # @return [Object] Returns the model itself
178
+ def self.build_from_hash(attributes)
179
+ new.build_from_hash(attributes)
147
180
  end
148
181
 
149
182
  # Builds the object from hash
@@ -151,9 +184,9 @@ module DyspatchClient
151
184
  # @return [Object] Returns the model itself
152
185
  def build_from_hash(attributes)
153
186
  return nil unless attributes.is_a?(Hash)
154
- self.class.swagger_types.each_pair do |key, type|
187
+ self.class.openapi_types.each_pair do |key, type|
155
188
  if type =~ /\AArray<(.*)>/i
156
- # check to ensure the input is an array given that the the attribute
189
+ # check to ensure the input is an array given that the attribute
157
190
  # is documented as an array but the input is not
158
191
  if attributes[self.class.attribute_map[key]].is_a?(Array)
159
192
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -182,7 +215,7 @@ module DyspatchClient
182
215
  value.to_i
183
216
  when :Float
184
217
  value.to_f
185
- when :BOOLEAN
218
+ when :Boolean
186
219
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
220
  true
188
221
  else
@@ -203,8 +236,7 @@ module DyspatchClient
203
236
  end
204
237
  end
205
238
  else # model
206
- temp_model = DyspatchClient.const_get(type).new
207
- temp_model.build_from_hash(value)
239
+ DyspatchClient.const_get(type).build_from_hash(value)
208
240
  end
209
241
  end
210
242
 
@@ -226,7 +258,11 @@ module DyspatchClient
226
258
  hash = {}
227
259
  self.class.attribute_map.each_pair do |attr, param|
228
260
  value = self.send(attr)
229
- next if value.nil?
261
+ if value.nil?
262
+ is_nullable = self.class.openapi_nullable.include?(attr)
263
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
264
+ end
265
+
230
266
  hash[param] = _to_hash(value)
231
267
  end
232
268
  hash
@@ -1,18 +1,19 @@
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: 2020.11
7
7
  Contact: support@dyspatch.io
8
- Generated by: https://github.com/swagger-api/swagger-codegen.git
9
- Swagger Codegen version: 2.4.9
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.3.1
10
10
 
11
11
  =end
12
12
 
13
13
  require 'date'
14
14
 
15
15
  module DyspatchClient
16
+ # the template metadata
16
17
  class TemplateMetaRead
17
18
  # An opaque, unique identifier for a template
18
19
  attr_accessor :id
@@ -49,7 +50,7 @@ module DyspatchClient
49
50
  end
50
51
 
51
52
  # Attribute type mapping.
52
- def self.swagger_types
53
+ def self.openapi_types
53
54
  {
54
55
  :'id' => :'String',
55
56
  :'name' => :'String',
@@ -61,42 +62,55 @@ module DyspatchClient
61
62
  }
62
63
  end
63
64
 
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
64
71
  # Initializes the object
65
72
  # @param [Hash] attributes Model attributes in the form of hash
66
73
  def initialize(attributes = {})
67
- return unless attributes.is_a?(Hash)
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DyspatchClient::TemplateMetaRead` initialize method"
76
+ end
68
77
 
69
- # convert string to symbol for hash key
70
- attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DyspatchClient::TemplateMetaRead`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
71
85
 
72
- if attributes.has_key?(:'id')
86
+ if attributes.key?(:'id')
73
87
  self.id = attributes[:'id']
74
88
  end
75
89
 
76
- if attributes.has_key?(:'name')
90
+ if attributes.key?(:'name')
77
91
  self.name = attributes[:'name']
78
92
  end
79
93
 
80
- if attributes.has_key?(:'description')
94
+ if attributes.key?(:'description')
81
95
  self.description = attributes[:'description']
82
96
  end
83
97
 
84
- if attributes.has_key?(:'url')
98
+ if attributes.key?(:'url')
85
99
  self.url = attributes[:'url']
86
100
  end
87
101
 
88
- if attributes.has_key?(:'localizations')
102
+ if attributes.key?(:'localizations')
89
103
  if (value = attributes[:'localizations']).is_a?(Array)
90
104
  self.localizations = value
91
105
  end
92
106
  end
93
107
 
94
- if attributes.has_key?(:'createdAt')
95
- self.created_at = attributes[:'createdAt']
108
+ if attributes.key?(:'created_at')
109
+ self.created_at = attributes[:'created_at']
96
110
  end
97
111
 
98
- if attributes.has_key?(:'updatedAt')
99
- self.updated_at = attributes[:'updatedAt']
112
+ if attributes.key?(:'updated_at')
113
+ self.updated_at = attributes[:'updated_at']
100
114
  end
101
115
  end
102
116
 
@@ -134,19 +148,26 @@ module DyspatchClient
134
148
  end
135
149
 
136
150
  # Calculates hash code according to all attributes.
137
- # @return [Fixnum] Hash code
151
+ # @return [Integer] Hash code
138
152
  def hash
139
153
  [id, name, description, url, localizations, created_at, updated_at].hash
140
154
  end
141
155
 
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
142
163
  # Builds the object from hash
143
164
  # @param [Hash] attributes Model attributes in the form of hash
144
165
  # @return [Object] Returns the model itself
145
166
  def build_from_hash(attributes)
146
167
  return nil unless attributes.is_a?(Hash)
147
- self.class.swagger_types.each_pair do |key, type|
168
+ self.class.openapi_types.each_pair do |key, type|
148
169
  if type =~ /\AArray<(.*)>/i
149
- # check to ensure the input is an array given that the the attribute
170
+ # check to ensure the input is an array given that the attribute
150
171
  # is documented as an array but the input is not
151
172
  if attributes[self.class.attribute_map[key]].is_a?(Array)
152
173
  self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
@@ -175,7 +196,7 @@ module DyspatchClient
175
196
  value.to_i
176
197
  when :Float
177
198
  value.to_f
178
- when :BOOLEAN
199
+ when :Boolean
179
200
  if value.to_s =~ /\A(true|t|yes|y|1)\z/i
180
201
  true
181
202
  else
@@ -196,8 +217,7 @@ module DyspatchClient
196
217
  end
197
218
  end
198
219
  else # model
199
- temp_model = DyspatchClient.const_get(type).new
200
- temp_model.build_from_hash(value)
220
+ DyspatchClient.const_get(type).build_from_hash(value)
201
221
  end
202
222
  end
203
223
 
@@ -219,7 +239,11 @@ module DyspatchClient
219
239
  hash = {}
220
240
  self.class.attribute_map.each_pair do |attr, param|
221
241
  value = self.send(attr)
222
- next if value.nil?
242
+ if value.nil?
243
+ is_nullable = self.class.openapi_nullable.include?(attr)
244
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
245
+ end
246
+
223
247
  hash[param] = _to_hash(value)
224
248
  end
225
249
  hash