wheniwork-ruby 1.0.0 → 1.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acd8c2c06b0a7168759c92a0f5119b67d0fb75a5
4
- data.tar.gz: 6d57508eb61fe6e4972fe5df9d0df86b21f854e6
3
+ metadata.gz: 938c7530237eca3b33407d27f212329243b948c6
4
+ data.tar.gz: d966a80396eff2f89a91ad3ba1dcb7f6204e4c94
5
5
  SHA512:
6
- metadata.gz: b68c5ead9587f435fd3587bed2070195328a3c3fd16ced6f8f84ed5f8ebc60f186bc26030d9585b3194f5432e23f8c76daf7cba6927b4e7f218d11f5cbb102f7
7
- data.tar.gz: 0021e58201f70e7c35775b7f23be2f0bfd4640233f87025106907cb0b88cb3a3f9a1c959800312f2b2c5b39e11aa499a87755add3774276a7145ec885de7ad0d
6
+ metadata.gz: 095ba8fc74d42067f686f68c3c87b45545e994efb06afca00ba376b4f612a6cb1ee04d41dac34cdd2337b203c74a89f239b0a8382f06251aa7fc98522ec51bc0
7
+ data.tar.gz: a8d28b58f67cc243581da5e0ca2c087d3a0849510f2b5e228ca5a3661ae7194539ea50941142ddfcd2bc9face9a7c78127415f198eec5ab2b05ac3f7b91d5f5f
data/README.md CHANGED
@@ -7,7 +7,7 @@ This SDK is automatically generated by the [Swagger Codegen](https://github.com/
7
7
 
8
8
  - API version: v2
9
9
  - Package version: 1.0.0
10
- - Build date: 2016-05-24T22:52:38.925-04:00
10
+ - Build date: 2016-05-25T14:18:09.696-04:00
11
11
  - Build package: class io.swagger.codegen.languages.RubyClientCodegen
12
12
 
13
13
  ## Installation
@@ -87,6 +87,7 @@ Class | Method | HTTP request | Description
87
87
  *WhenIWork::Api* | [**get_shift**](docs/Api.md#get_shift) | **GET** /shifts/{shift-id} |
88
88
  *WhenIWork::Api* | [**get_shifts**](docs/Api.md#get_shifts) | **GET** /shifts |
89
89
  *WhenIWork::Api* | [**get_user**](docs/Api.md#get_user) | **GET** /users/{user-id} |
90
+ *WhenIWork::Api* | [**get_users**](docs/Api.md#get_users) | **GET** /users |
90
91
 
91
92
 
92
93
  ## Documentation for Models
@@ -95,6 +96,7 @@ Class | Method | HTTP request | Description
95
96
  - [WhenIWork::InlineResponse2001](docs/InlineResponse2001.md)
96
97
  - [WhenIWork::InlineResponse2002](docs/InlineResponse2002.md)
97
98
  - [WhenIWork::InlineResponse2003](docs/InlineResponse2003.md)
99
+ - [WhenIWork::InlineResponse2004](docs/InlineResponse2004.md)
98
100
  - [WhenIWork::Position](docs/Position.md)
99
101
  - [WhenIWork::Shift](docs/Shift.md)
100
102
  - [WhenIWork::User](docs/User.md)
@@ -3,6 +3,6 @@
3
3
  ## Properties
4
4
  Name | Type | Description | Notes
5
5
  ------------ | ------------- | ------------- | -------------
6
- **user** | [**User**](User.md) | | [optional]
6
+ **users** | [**Array<User>**](User.md) | | [optional]
7
7
 
8
8
 
@@ -0,0 +1,8 @@
1
+ # WhenIWork::InlineResponse2004
2
+
3
+ ## Properties
4
+ Name | Type | Description | Notes
5
+ ------------ | ------------- | ------------- | -------------
6
+ **user** | [**User**](User.md) | | [optional]
7
+
8
+
@@ -24,12 +24,14 @@ require 'wheniwork-ruby/api_client'
24
24
  require 'wheniwork-ruby/api_error'
25
25
  require 'wheniwork-ruby/version'
26
26
  require 'wheniwork-ruby/configuration'
27
+ require 'wheniwork-ruby/modules/response'
27
28
 
28
29
  # Models
29
30
  require 'wheniwork-ruby/models/inline_response_200'
30
31
  require 'wheniwork-ruby/models/inline_response_200_1'
31
32
  require 'wheniwork-ruby/models/inline_response_200_2'
32
33
  require 'wheniwork-ruby/models/inline_response_200_3'
34
+ require 'wheniwork-ruby/models/inline_response_200_4'
33
35
  require 'wheniwork-ruby/models/position'
34
36
  require 'wheniwork-ruby/models/shift'
35
37
  require 'wheniwork-ruby/models/user'
@@ -37,6 +39,8 @@ require 'wheniwork-ruby/models/user'
37
39
  # APIs
38
40
  require 'wheniwork-ruby/api/api'
39
41
 
42
+ # modules
43
+
40
44
  module WhenIWork
41
45
  class << self
42
46
  # Customize default settings for the SDK using block.
@@ -146,8 +146,8 @@ module WhenIWork
146
146
  # Get a list of shifts.
147
147
  # @param [Hash] opts the optional parameters
148
148
  # @option opts [String] :user_id The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3).
149
- # @option opts [DateTime] :start Start time for the search window. The default is the current date and time
150
- # @option opts [DateTime] :_end End time for the search window. The default is exactly three days from the start time.
149
+ # @option opts [DateTime] :start_time Start time for the search window. The default is the current date and time
150
+ # @option opts [DateTime] :end_time End time for the search window. The default is exactly three days from the start time.
151
151
  # @option opts [String] :location_id The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas.
152
152
  # @option opts [String] :position_id The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas.
153
153
  # @option opts [BOOLEAN] :include_open Whether to include OpenShifts in the results.
@@ -163,8 +163,8 @@ module WhenIWork
163
163
  # Get a list of shifts.
164
164
  # @param [Hash] opts the optional parameters
165
165
  # @option opts [String] :user_id The ID of the user to get shifts for. For multiple users, enter a list of user IDs separated by commas (e.g. 1,5,3).
166
- # @option opts [DateTime] :start Start time for the search window. The default is the current date and time
167
- # @option opts [DateTime] :_end End time for the search window. The default is exactly three days from the start time.
166
+ # @option opts [DateTime] :start_date Start time for the search window. The default is the current date and time
167
+ # @option opts [DateTime] :end_date End time for the search window. The default is exactly three days from the start time.
168
168
  # @option opts [String] :location_id The ID of the location to get shifts for. For multiple locations, enter a list of location IDs separated by commas.
169
169
  # @option opts [String] :position_id The ID of the position to get shifts for. For multiple position, enter a list of position IDs separated by commas.
170
170
  # @option opts [BOOLEAN] :include_open Whether to include OpenShifts in the results.
@@ -181,8 +181,8 @@ module WhenIWork
181
181
  # query parameters
182
182
  query_params = {}
183
183
  query_params[:'user_id'] = opts[:'user_id'] if opts[:'user_id']
184
- query_params[:'start'] = opts[:'start'] if opts[:'start']
185
- query_params[:'end'] = opts[:'_end'] if opts[:'_end']
184
+ query_params[:'start'] = opts[:'start_date'] if opts[:'start_date']
185
+ query_params[:'end'] = opts[:'end_date'] if opts[:'end_date']
186
186
  query_params[:'location_id'] = opts[:'location_id'] if opts[:'location_id']
187
187
  query_params[:'position_id'] = opts[:'position_id'] if opts[:'position_id']
188
188
  query_params[:'include_open'] = opts[:'include_open'] if opts[:'include_open']
@@ -275,5 +275,69 @@ module WhenIWork
275
275
  end
276
276
  return data, status_code, headers
277
277
  end
278
+
279
+ #
280
+ # Get a list of users.
281
+ # @param [Hash] opts the optional parameters
282
+ # @option opts [String] :ids The IDs of the users to retrieve, as a comma-separated list (e.g. 9,17,42).
283
+ # @option opts [String] :location_id The ID of the location to get users for. For multiple locations, enter a list of location IDs separated by commas.
284
+ # @option opts [BOOLEAN] :show_deleted Whether to include deleted users in the results. Defaults to false.
285
+ # @return [InlineResponse2003]
286
+ def get_users(opts = {})
287
+ data, status_code, headers = get_users_with_http_info(opts)
288
+ return data
289
+ end
290
+
291
+ #
292
+ # Get a list of users.
293
+ # @param [Hash] opts the optional parameters
294
+ # @option opts [String] :ids The IDs of the users to retrieve, as a comma-separated list (e.g. 9,17,42).
295
+ # @option opts [String] :location_id The ID of the location to get users for. For multiple locations, enter a list of location IDs separated by commas.
296
+ # @option opts [BOOLEAN] :show_deleted Whether to include deleted users in the results. Defaults to false.
297
+ # @return [Array<(InlineResponse2003, Fixnum, Hash)>] InlineResponse2003 data, response status code and response headers
298
+ def get_users_with_http_info(opts = {})
299
+ if @api_client.config.debugging
300
+ @api_client.config.logger.debug "Calling API: DefaultApi#get_users ..."
301
+ end
302
+
303
+ # resource path
304
+ local_var_path = "/users".sub('{format}','json')
305
+
306
+ # query parameters
307
+ query_params = {}
308
+ query_params[:'ids'] = opts[:'ids'] if opts[:'ids']
309
+ query_params[:'location_id'] = opts[:'location_id'] if opts[:'location_id']
310
+ query_params[:'show_deleted'] = opts[:'show_deleted'] if opts[:'show_deleted']
311
+
312
+ # header parameters
313
+ header_params = {}
314
+
315
+ # HTTP header 'Accept' (if needed)
316
+ _header_accept = ['application/json']
317
+ _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result
318
+
319
+ # HTTP header 'Content-Type'
320
+ _header_content_type = ['application/json']
321
+ header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)
322
+
323
+ # form parameters
324
+ form_params = {}
325
+
326
+ # http body (model)
327
+ post_body = nil
328
+
329
+ auth_names = ['apiKey']
330
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path,
331
+ :header_params => header_params,
332
+ :query_params => query_params,
333
+ :form_params => form_params,
334
+ :body => post_body,
335
+ :auth_names => auth_names,
336
+ :return_type => 'InlineResponse2003')
337
+ if @api_client.config.debugging
338
+ @api_client.config.logger.debug "API called: DefaultApi#get_users\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
339
+ end
340
+ return data, status_code, headers
341
+ end
278
342
  end
279
343
  end
@@ -22,8 +22,9 @@ limitations under the License.
22
22
  require 'date'
23
23
 
24
24
  module WhenIWork
25
-
26
25
  class InlineResponse200
26
+ include WhenIWork::Response
27
+
27
28
  attr_accessor :positions
28
29
 
29
30
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -53,7 +54,6 @@ module WhenIWork
53
54
  self.positions = value
54
55
  end
55
56
  end
56
-
57
57
  end
58
58
 
59
59
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -71,15 +71,8 @@ module WhenIWork
71
71
  # Checks equality by comparing each attribute.
72
72
  # @param [Object] Object to be compared
73
73
  def ==(o)
74
- return true if self.equal?(o)
75
- self.class == o.class &&
76
- positions == o.positions
77
- end
78
-
79
- # @see the `==` method
80
- # @param [Object] Object to be compared
81
- def eql?(o)
82
- self == o
74
+ return true if equal?(o)
75
+ self.class == o.class && positions == o.positions
83
76
  end
84
77
 
85
78
  # Calculates hash code according to all attributes.
@@ -87,109 +80,5 @@ module WhenIWork
87
80
  def hash
88
81
  [positions].hash
89
82
  end
90
-
91
- # Builds the object from hash
92
- # @param [Hash] attributes Model attributes in the form of hash
93
- # @return [Object] Returns the model itself
94
- def build_from_hash(attributes)
95
- return nil unless attributes.is_a?(Hash)
96
- self.class.swagger_types.each_pair do |key, type|
97
- if type =~ /^Array<(.*)>/i
98
- # check to ensure the input is an array given that the the attribute
99
- # is documented as an array but the input is not
100
- if attributes[self.class.attribute_map[key]].is_a?(Array)
101
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
102
- end
103
- elsif !attributes[self.class.attribute_map[key]].nil?
104
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
105
- end # or else data not found in attributes(hash), not an issue as the data can be optional
106
- end
107
-
108
- self
109
- end
110
-
111
- # Deserializes the data based on type
112
- # @param string type Data type
113
- # @param string value Value to be deserialized
114
- # @return [Object] Deserialized data
115
- def _deserialize(type, value)
116
- case type.to_sym
117
- when :DateTime
118
- DateTime.parse(value)
119
- when :Date
120
- Date.parse(value)
121
- when :String
122
- value.to_s
123
- when :Integer
124
- value.to_i
125
- when :Float
126
- value.to_f
127
- when :BOOLEAN
128
- if value.to_s =~ /^(true|t|yes|y|1)$/i
129
- true
130
- else
131
- false
132
- end
133
- when :Object
134
- # generic object (usually a Hash), return directly
135
- value
136
- when /\AArray<(?<inner_type>.+)>\z/
137
- inner_type = Regexp.last_match[:inner_type]
138
- value.map { |v| _deserialize(inner_type, v) }
139
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
140
- k_type = Regexp.last_match[:k_type]
141
- v_type = Regexp.last_match[:v_type]
142
- {}.tap do |hash|
143
- value.each do |k, v|
144
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
145
- end
146
- end
147
- else # model
148
- temp_model = WhenIWork.const_get(type).new
149
- temp_model.build_from_hash(value)
150
- end
151
- end
152
-
153
- # Returns the string representation of the object
154
- # @return [String] String presentation of the object
155
- def to_s
156
- to_hash.to_s
157
- end
158
-
159
- # to_body is an alias to to_hash (backward compatibility)
160
- # @return [Hash] Returns the object in the form of hash
161
- def to_body
162
- to_hash
163
- end
164
-
165
- # Returns the object in the form of hash
166
- # @return [Hash] Returns the object in the form of hash
167
- def to_hash
168
- hash = {}
169
- self.class.attribute_map.each_pair do |attr, param|
170
- value = self.send(attr)
171
- next if value.nil?
172
- hash[param] = _to_hash(value)
173
- end
174
- hash
175
- end
176
-
177
- # Outputs non-array value in the form of hash
178
- # For object, use to_hash. Otherwise, just return the value
179
- # @param [Object] value Any valid value
180
- # @return [Hash] Returns the value in the form of hash
181
- def _to_hash(value)
182
- if value.is_a?(Array)
183
- value.compact.map{ |v| _to_hash(v) }
184
- elsif value.is_a?(Hash)
185
- {}.tap do |hash|
186
- value.each { |k, v| hash[k] = _to_hash(v) }
187
- end
188
- elsif value.respond_to? :to_hash
189
- value.to_hash
190
- else
191
- value
192
- end
193
- end
194
83
  end
195
84
  end
@@ -22,8 +22,9 @@ limitations under the License.
22
22
  require 'date'
23
23
 
24
24
  module WhenIWork
25
-
26
25
  class InlineResponse2001
26
+ include WhenIWork::Response
27
+
27
28
  attr_accessor :start
28
29
 
29
30
  attr_accessor :_end
@@ -94,38 +95,12 @@ module WhenIWork
94
95
  shifts == o.shifts
95
96
  end
96
97
 
97
- # @see the `==` method
98
- # @param [Object] Object to be compared
99
- def eql?(o)
100
- self == o
101
- end
102
-
103
98
  # Calculates hash code according to all attributes.
104
99
  # @return [Fixnum] Hash code
105
100
  def hash
106
101
  [start, _end, shifts].hash
107
102
  end
108
103
 
109
- # Builds the object from hash
110
- # @param [Hash] attributes Model attributes in the form of hash
111
- # @return [Object] Returns the model itself
112
- def build_from_hash(attributes)
113
- return nil unless attributes.is_a?(Hash)
114
- self.class.swagger_types.each_pair do |key, type|
115
- if type =~ /^Array<(.*)>/i
116
- # check to ensure the input is an array given that the the attribute
117
- # is documented as an array but the input is not
118
- if attributes[self.class.attribute_map[key]].is_a?(Array)
119
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
120
- end
121
- elsif !attributes[self.class.attribute_map[key]].nil?
122
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
- end # or else data not found in attributes(hash), not an issue as the data can be optional
124
- end
125
-
126
- self
127
- end
128
-
129
104
  # Deserializes the data based on type
130
105
  # @param string type Data type
131
106
  # @param string value Value to be deserialized
@@ -209,7 +184,5 @@ module WhenIWork
209
184
  value
210
185
  end
211
186
  end
212
-
213
187
  end
214
-
215
188
  end
@@ -22,8 +22,9 @@ limitations under the License.
22
22
  require 'date'
23
23
 
24
24
  module WhenIWork
25
-
26
25
  class InlineResponse2002
26
+ include WhenIWork::Response
27
+
27
28
  attr_accessor :shift
28
29
 
29
30
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -74,122 +75,10 @@ module WhenIWork
74
75
  shift == o.shift
75
76
  end
76
77
 
77
- # @see the `==` method
78
- # @param [Object] Object to be compared
79
- def eql?(o)
80
- self == o
81
- end
82
-
83
78
  # Calculates hash code according to all attributes.
84
79
  # @return [Fixnum] Hash code
85
80
  def hash
86
81
  [shift].hash
87
82
  end
88
-
89
- # Builds the object from hash
90
- # @param [Hash] attributes Model attributes in the form of hash
91
- # @return [Object] Returns the model itself
92
- def build_from_hash(attributes)
93
- return nil unless attributes.is_a?(Hash)
94
- self.class.swagger_types.each_pair do |key, type|
95
- if type =~ /^Array<(.*)>/i
96
- # check to ensure the input is an array given that the the attribute
97
- # is documented as an array but the input is not
98
- if attributes[self.class.attribute_map[key]].is_a?(Array)
99
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
100
- end
101
- elsif !attributes[self.class.attribute_map[key]].nil?
102
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
103
- end # or else data not found in attributes(hash), not an issue as the data can be optional
104
- end
105
-
106
- self
107
- end
108
-
109
- # Deserializes the data based on type
110
- # @param string type Data type
111
- # @param string value Value to be deserialized
112
- # @return [Object] Deserialized data
113
- def _deserialize(type, value)
114
- case type.to_sym
115
- when :DateTime
116
- DateTime.parse(value)
117
- when :Date
118
- Date.parse(value)
119
- when :String
120
- value.to_s
121
- when :Integer
122
- value.to_i
123
- when :Float
124
- value.to_f
125
- when :BOOLEAN
126
- if value.to_s =~ /^(true|t|yes|y|1)$/i
127
- true
128
- else
129
- false
130
- end
131
- when :Object
132
- # generic object (usually a Hash), return directly
133
- value
134
- when /\AArray<(?<inner_type>.+)>\z/
135
- inner_type = Regexp.last_match[:inner_type]
136
- value.map { |v| _deserialize(inner_type, v) }
137
- when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
138
- k_type = Regexp.last_match[:k_type]
139
- v_type = Regexp.last_match[:v_type]
140
- {}.tap do |hash|
141
- value.each do |k, v|
142
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
143
- end
144
- end
145
- else # model
146
- temp_model = WhenIWork.const_get(type).new
147
- temp_model.build_from_hash(value)
148
- end
149
- end
150
-
151
- # Returns the string representation of the object
152
- # @return [String] String presentation of the object
153
- def to_s
154
- to_hash.to_s
155
- end
156
-
157
- # to_body is an alias to to_hash (backward compatibility)
158
- # @return [Hash] Returns the object in the form of hash
159
- def to_body
160
- to_hash
161
- end
162
-
163
- # Returns the object in the form of hash
164
- # @return [Hash] Returns the object in the form of hash
165
- def to_hash
166
- hash = {}
167
- self.class.attribute_map.each_pair do |attr, param|
168
- value = self.send(attr)
169
- next if value.nil?
170
- hash[param] = _to_hash(value)
171
- end
172
- hash
173
- end
174
-
175
- # Outputs non-array value in the form of hash
176
- # For object, use to_hash. Otherwise, just return the value
177
- # @param [Object] value Any valid value
178
- # @return [Hash] Returns the value in the form of hash
179
- def _to_hash(value)
180
- if value.is_a?(Array)
181
- value.compact.map{ |v| _to_hash(v) }
182
- elsif value.is_a?(Hash)
183
- {}.tap do |hash|
184
- value.each { |k, v| hash[k] = _to_hash(v) }
185
- end
186
- elsif value.respond_to? :to_hash
187
- value.to_hash
188
- else
189
- value
190
- end
191
- end
192
-
193
83
  end
194
-
195
84
  end