patch_ruby 1.14.0 → 1.15.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 +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +1 -1
- data/lib/patch_ruby/api/technology_types_api.rb +84 -0
- data/lib/patch_ruby/api_client.rb +1 -1
- data/lib/patch_ruby/models/parent_technology_type.rb +1 -0
- data/lib/patch_ruby/models/project.rb +21 -29
- data/lib/patch_ruby/models/technology_type.rb +12 -1
- data/lib/patch_ruby/models/technology_type_list_response.rb +259 -0
- data/lib/patch_ruby/version.rb +1 -1
- data/lib/patch_ruby.rb +2 -0
- data/spec/api/technology_types_api_spec.rb +46 -0
- data/spec/integration/projects/technology_types_spec.rb +14 -0
- data/spec/models/project_spec.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a338171de1603165ff7c077c2c1607c4ed157718437c2e0b6d1661ab44d122db
|
4
|
+
data.tar.gz: 96f84e3602fb5ad9e6b22ac91873c004dcce0f1da76c93471ba323f24075e5e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2c20ecb8c28c1f418814c94c8d9c788658fbda38e6aada43cf909ecb8f80b3a922704ba1d3cd862c5f6f44e84c691cb2e2acc564f69e4332c4394a636fe52e71
|
7
|
+
data.tar.gz: 80e864a530bbc4d422a4c7f28cc6e6dc7471b759e8a6dd443909466214d638e0e11457007fc3349f4a4aade5c9144d33a980e5756c8e41f18be6a263d0c380d0
|
data/CHANGELOG.md
CHANGED
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [1.15.0] - 2021-10-04
|
9
|
+
|
10
|
+
### Added
|
11
|
+
|
12
|
+
- Added the ability to fetch project technology types via `Patch::TechnologyType.retrieve_technology_types()`
|
13
|
+
|
8
14
|
## [1.14.0] - 2021-09-21
|
9
15
|
|
10
16
|
### Added
|
data/Gemfile.lock
CHANGED
@@ -0,0 +1,84 @@
|
|
1
|
+
=begin
|
2
|
+
#Patch API V1
|
3
|
+
|
4
|
+
#The core API used to integrate with Patch's service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: developers@usepatch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'cgi'
|
14
|
+
|
15
|
+
module Patch
|
16
|
+
class TechnologyTypesApi
|
17
|
+
OPERATIONS = [
|
18
|
+
:retrieve_technology_types,
|
19
|
+
]
|
20
|
+
|
21
|
+
attr_accessor :api_client
|
22
|
+
|
23
|
+
def initialize(api_client = ApiClient.default)
|
24
|
+
@api_client = api_client
|
25
|
+
end
|
26
|
+
# Retrieves the list of technology_types
|
27
|
+
# Retrieves a list of all technology_types.
|
28
|
+
# @param [Hash] opts the optional parameters
|
29
|
+
# @return [TechnologyTypeListResponse]
|
30
|
+
def retrieve_technology_types(opts = {})
|
31
|
+
|
32
|
+
data, _status_code, _headers = retrieve_technology_types_with_http_info(opts)
|
33
|
+
data
|
34
|
+
end
|
35
|
+
|
36
|
+
# Retrieves the list of technology_types
|
37
|
+
# Retrieves a list of all technology_types.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [Array<(TechnologyTypeListResponse, Integer, Hash)>] TechnologyTypeListResponse data, response status code and response headers
|
40
|
+
def retrieve_technology_types_with_http_info(opts = {})
|
41
|
+
if @api_client.config.debugging
|
42
|
+
@api_client.config.logger.debug 'Calling API: TechnologyTypesApi.retrieve_technology_types ...'
|
43
|
+
end
|
44
|
+
# resource path
|
45
|
+
local_var_path = '/v1/projects/technology_types'
|
46
|
+
|
47
|
+
# query parameters
|
48
|
+
query_params = opts[:query_params] || {}
|
49
|
+
|
50
|
+
# header parameters
|
51
|
+
header_params = opts[:header_params] || {}
|
52
|
+
# HTTP header 'Accept' (if needed)
|
53
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
54
|
+
|
55
|
+
# form parameters
|
56
|
+
form_params = opts[:form_params] || {}
|
57
|
+
|
58
|
+
# http body (model)
|
59
|
+
post_body = opts[:debug_body]
|
60
|
+
|
61
|
+
# return_type
|
62
|
+
return_type = opts[:debug_return_type] || 'TechnologyTypeListResponse'
|
63
|
+
|
64
|
+
# auth_names
|
65
|
+
auth_names = opts[:debug_auth_names] || ['bearer_auth']
|
66
|
+
|
67
|
+
new_options = opts.merge(
|
68
|
+
:operation => :"TechnologyTypesApi.retrieve_technology_types",
|
69
|
+
:header_params => header_params,
|
70
|
+
:query_params => query_params,
|
71
|
+
:form_params => form_params,
|
72
|
+
:body => post_body,
|
73
|
+
:auth_names => auth_names,
|
74
|
+
:return_type => return_type
|
75
|
+
)
|
76
|
+
|
77
|
+
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
|
78
|
+
if @api_client.config.debugging
|
79
|
+
@api_client.config.logger.debug "API called: TechnologyTypesApi#retrieve_technology_types\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
80
|
+
end
|
81
|
+
return data, status_code, headers
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
@@ -31,7 +31,7 @@ module Patch
|
|
31
31
|
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
|
32
32
|
def initialize(config = Configuration.default)
|
33
33
|
@config = config
|
34
|
-
@user_agent = "patch-ruby/1.
|
34
|
+
@user_agent = "patch-ruby/1.15.0"
|
35
35
|
@default_headers = {
|
36
36
|
'Content-Type' => 'application/json',
|
37
37
|
'User-Agent' => @user_agent
|
@@ -27,10 +27,10 @@ module Patch
|
|
27
27
|
# The description of the project.
|
28
28
|
attr_accessor :description
|
29
29
|
|
30
|
-
#
|
30
|
+
# Deprecated. Favor the technology_type field instead.
|
31
31
|
attr_accessor :type
|
32
32
|
|
33
|
-
# The mechanism of the project. removal or avoidance.
|
33
|
+
# The mechanism of the project. Either removal or avoidance.
|
34
34
|
attr_accessor :mechanism
|
35
35
|
|
36
36
|
# The country of origin of the project.
|
@@ -63,11 +63,11 @@ module Patch
|
|
63
63
|
# An array returning the UN Sustainable Development Goals associated with this project.
|
64
64
|
attr_accessor :sdgs
|
65
65
|
|
66
|
-
|
67
|
-
|
68
|
-
# A short description of the project
|
66
|
+
# A short description of the project.
|
69
67
|
attr_accessor :tagline
|
70
68
|
|
69
|
+
attr_accessor :technology_type
|
70
|
+
|
71
71
|
class EnumAttributeValidator
|
72
72
|
attr_reader :datatype
|
73
73
|
attr_reader :allowable_values
|
@@ -109,8 +109,8 @@ module Patch
|
|
109
109
|
:'remaining_mass_g' => :'remaining_mass_g',
|
110
110
|
:'standard' => :'standard',
|
111
111
|
:'sdgs' => :'sdgs',
|
112
|
-
:'
|
113
|
-
:'
|
112
|
+
:'tagline' => :'tagline',
|
113
|
+
:'technology_type' => :'technology_type'
|
114
114
|
}
|
115
115
|
end
|
116
116
|
|
@@ -138,8 +138,8 @@ module Patch
|
|
138
138
|
:'remaining_mass_g' => :'Integer',
|
139
139
|
:'standard' => :'Standard',
|
140
140
|
:'sdgs' => :'Array<Sdg>',
|
141
|
-
:'
|
142
|
-
:'
|
141
|
+
:'tagline' => :'String',
|
142
|
+
:'technology_type' => :'TechnologyType'
|
143
143
|
}
|
144
144
|
end
|
145
145
|
|
@@ -152,7 +152,6 @@ module Patch
|
|
152
152
|
:'photos',
|
153
153
|
:'standard',
|
154
154
|
:'sdgs',
|
155
|
-
:'tagline'
|
156
155
|
])
|
157
156
|
end
|
158
157
|
|
@@ -251,13 +250,13 @@ module Patch
|
|
251
250
|
end
|
252
251
|
end
|
253
252
|
|
254
|
-
if attributes.key?(:'technology_type')
|
255
|
-
self.technology_type = attributes[:'technology_type']
|
256
|
-
end
|
257
|
-
|
258
253
|
if attributes.key?(:'tagline')
|
259
254
|
self.tagline = attributes[:'tagline']
|
260
255
|
end
|
256
|
+
|
257
|
+
if attributes.key?(:'technology_type')
|
258
|
+
self.technology_type = attributes[:'technology_type']
|
259
|
+
end
|
261
260
|
end
|
262
261
|
|
263
262
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -296,6 +295,10 @@ module Patch
|
|
296
295
|
invalid_properties.push('invalid value for "remaining_mass_g", remaining_mass_g cannot be nil.')
|
297
296
|
end
|
298
297
|
|
298
|
+
if @technology_type.nil?
|
299
|
+
invalid_properties.push('invalid value for "technology_type", technology_type cannot be nil.')
|
300
|
+
end
|
301
|
+
|
299
302
|
invalid_properties
|
300
303
|
end
|
301
304
|
|
@@ -306,27 +309,16 @@ module Patch
|
|
306
309
|
return false if @production.nil?
|
307
310
|
return false if @name.nil?
|
308
311
|
return false if @description.nil?
|
309
|
-
type_validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"])
|
310
|
-
return false unless type_validator.valid?(@type)
|
311
312
|
mechanism_validator = EnumAttributeValidator.new('String', ["removal", "avoidance"])
|
312
313
|
return false unless mechanism_validator.valid?(@mechanism)
|
313
314
|
return false if @country.nil?
|
314
315
|
return false if @developer.nil?
|
315
316
|
return false if @average_price_per_tonne_cents_usd.nil?
|
316
317
|
return false if @remaining_mass_g.nil?
|
318
|
+
return false if @technology_type.nil?
|
317
319
|
true
|
318
320
|
end
|
319
321
|
|
320
|
-
# Custom attribute writer method checking allowed values (enum).
|
321
|
-
# @param [Object] type Object to be assigned
|
322
|
-
def type=(type)
|
323
|
-
validator = EnumAttributeValidator.new('String', ["biomass", "dac", "forestry", "mineralization", "ocean", "renewables", "soil"])
|
324
|
-
unless validator.valid?(type)
|
325
|
-
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
326
|
-
end
|
327
|
-
@type = type
|
328
|
-
end
|
329
|
-
|
330
322
|
# Custom attribute writer method checking allowed values (enum).
|
331
323
|
# @param [Object] mechanism Object to be assigned
|
332
324
|
def mechanism=(mechanism)
|
@@ -358,8 +350,8 @@ module Patch
|
|
358
350
|
remaining_mass_g == o.remaining_mass_g &&
|
359
351
|
standard == o.standard &&
|
360
352
|
sdgs == o.sdgs &&
|
361
|
-
|
362
|
-
|
353
|
+
tagline == o.tagline &&
|
354
|
+
technology_type == o.technology_type
|
363
355
|
end
|
364
356
|
|
365
357
|
# @see the `==` method
|
@@ -371,7 +363,7 @@ module Patch
|
|
371
363
|
# Calculates hash code according to all attributes.
|
372
364
|
# @return [Integer] Hash code
|
373
365
|
def hash
|
374
|
-
[id, production, name, description, type, mechanism, country, state, latitude, longitude, developer, photos, average_price_per_tonne_cents_usd, remaining_mass_g, standard, sdgs,
|
366
|
+
[id, production, name, description, type, mechanism, country, state, latitude, longitude, developer, photos, average_price_per_tonne_cents_usd, remaining_mass_g, standard, sdgs, tagline, technology_type].hash
|
375
367
|
end
|
376
368
|
|
377
369
|
# Builds the object from hash
|
@@ -14,11 +14,12 @@ require 'date'
|
|
14
14
|
require 'time'
|
15
15
|
|
16
16
|
module Patch
|
17
|
+
# An object containing the technology type's name, slug and parent_technology_type.
|
17
18
|
class TechnologyType
|
18
19
|
# Unique identifier for this type of technology.
|
19
20
|
attr_accessor :slug
|
20
21
|
|
21
|
-
#
|
22
|
+
# Display name of this technology type.
|
22
23
|
attr_accessor :name
|
23
24
|
|
24
25
|
attr_accessor :parent_technology_type
|
@@ -96,12 +97,22 @@ module Patch
|
|
96
97
|
# @return Array for valid properties with the reasons
|
97
98
|
def list_invalid_properties
|
98
99
|
invalid_properties = Array.new
|
100
|
+
if @slug.nil?
|
101
|
+
invalid_properties.push('invalid value for "slug", slug cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @name.nil?
|
105
|
+
invalid_properties.push('invalid value for "name", name cannot be nil.')
|
106
|
+
end
|
107
|
+
|
99
108
|
invalid_properties
|
100
109
|
end
|
101
110
|
|
102
111
|
# Check to see if the all the properties in the model are valid
|
103
112
|
# @return true if the model is valid
|
104
113
|
def valid?
|
114
|
+
return false if @slug.nil?
|
115
|
+
return false if @name.nil?
|
105
116
|
true
|
106
117
|
end
|
107
118
|
|
@@ -0,0 +1,259 @@
|
|
1
|
+
=begin
|
2
|
+
#Patch API V1
|
3
|
+
|
4
|
+
#The core API used to integrate with Patch's service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: developers@usepatch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
require 'time'
|
15
|
+
|
16
|
+
module Patch
|
17
|
+
class TechnologyTypeListResponse
|
18
|
+
attr_accessor :success
|
19
|
+
|
20
|
+
attr_accessor :error
|
21
|
+
|
22
|
+
attr_accessor :data
|
23
|
+
|
24
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
25
|
+
def self.attribute_map
|
26
|
+
{
|
27
|
+
:'success' => :'success',
|
28
|
+
:'error' => :'error',
|
29
|
+
:'data' => :'data'
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns all the JSON keys this model knows about
|
34
|
+
def self.acceptable_attributes
|
35
|
+
attribute_map.values
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.openapi_types
|
40
|
+
{
|
41
|
+
:'success' => :'Boolean',
|
42
|
+
:'error' => :'Object',
|
43
|
+
:'data' => :'Array<TechnologyType>'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
|
47
|
+
# List of attributes with nullable: true
|
48
|
+
def self.openapi_nullable
|
49
|
+
Set.new([
|
50
|
+
:'error',
|
51
|
+
])
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
# Allows models with corresponding API classes to delegate API operations to those API classes
|
56
|
+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
|
57
|
+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
|
58
|
+
def self.method_missing(message, *args, &block)
|
59
|
+
if Object.const_defined?('Patch::TechnologyTypeListResponsesApi::OPERATIONS') && Patch::TechnologyTypeListResponsesApi::OPERATIONS.include?(message)
|
60
|
+
Patch::TechnologyTypeListResponsesApi.new.send(message, *args)
|
61
|
+
else
|
62
|
+
super
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Initializes the object
|
67
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
68
|
+
def initialize(attributes = {})
|
69
|
+
if (!attributes.is_a?(Hash))
|
70
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::TechnologyTypeListResponse` initialize method"
|
71
|
+
end
|
72
|
+
|
73
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
74
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
75
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
76
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::TechnologyTypeListResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
77
|
+
end
|
78
|
+
h[k.to_sym] = v
|
79
|
+
}
|
80
|
+
|
81
|
+
if attributes.key?(:'success')
|
82
|
+
self.success = attributes[:'success']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.key?(:'error')
|
86
|
+
self.error = attributes[:'error']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.key?(:'data')
|
90
|
+
if (value = attributes[:'data']).is_a?(Array)
|
91
|
+
self.data = value
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
97
|
+
# @return Array for valid properties with the reasons
|
98
|
+
def list_invalid_properties
|
99
|
+
invalid_properties = Array.new
|
100
|
+
if @success.nil?
|
101
|
+
invalid_properties.push('invalid value for "success", success cannot be nil.')
|
102
|
+
end
|
103
|
+
|
104
|
+
if @data.nil?
|
105
|
+
invalid_properties.push('invalid value for "data", data cannot be nil.')
|
106
|
+
end
|
107
|
+
|
108
|
+
invalid_properties
|
109
|
+
end
|
110
|
+
|
111
|
+
# Check to see if the all the properties in the model are valid
|
112
|
+
# @return true if the model is valid
|
113
|
+
def valid?
|
114
|
+
return false if @success.nil?
|
115
|
+
return false if @data.nil?
|
116
|
+
true
|
117
|
+
end
|
118
|
+
|
119
|
+
# Checks equality by comparing each attribute.
|
120
|
+
# @param [Object] Object to be compared
|
121
|
+
def ==(o)
|
122
|
+
return true if self.equal?(o)
|
123
|
+
self.class == o.class &&
|
124
|
+
success == o.success &&
|
125
|
+
error == o.error &&
|
126
|
+
data == o.data
|
127
|
+
end
|
128
|
+
|
129
|
+
# @see the `==` method
|
130
|
+
# @param [Object] Object to be compared
|
131
|
+
def eql?(o)
|
132
|
+
self == o
|
133
|
+
end
|
134
|
+
|
135
|
+
# Calculates hash code according to all attributes.
|
136
|
+
# @return [Integer] Hash code
|
137
|
+
def hash
|
138
|
+
[success, error, data].hash
|
139
|
+
end
|
140
|
+
|
141
|
+
# Builds the object from hash
|
142
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
143
|
+
# @return [Object] Returns the model itself
|
144
|
+
def self.build_from_hash(attributes)
|
145
|
+
new.build_from_hash(attributes)
|
146
|
+
end
|
147
|
+
|
148
|
+
# Builds the object from hash
|
149
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
150
|
+
# @return [Object] Returns the model itself
|
151
|
+
def build_from_hash(attributes)
|
152
|
+
return nil unless attributes.is_a?(Hash)
|
153
|
+
self.class.openapi_types.each_pair do |key, type|
|
154
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
155
|
+
self.send("#{key}=", nil)
|
156
|
+
elsif type =~ /\AArray<(.*)>/i
|
157
|
+
# check to ensure the input is an array given that the attribute
|
158
|
+
# is documented as an array but the input is not
|
159
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
160
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
161
|
+
end
|
162
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
163
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
167
|
+
self
|
168
|
+
end
|
169
|
+
|
170
|
+
# Deserializes the data based on type
|
171
|
+
# @param string type Data type
|
172
|
+
# @param string value Value to be deserialized
|
173
|
+
# @return [Object] Deserialized data
|
174
|
+
def _deserialize(type, value)
|
175
|
+
case type.to_sym
|
176
|
+
when :Time
|
177
|
+
Time.parse(value)
|
178
|
+
when :Date
|
179
|
+
Date.parse(value)
|
180
|
+
when :String
|
181
|
+
value.to_s
|
182
|
+
when :Integer
|
183
|
+
value.to_i
|
184
|
+
when :Float
|
185
|
+
value.to_f
|
186
|
+
when :Boolean
|
187
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
188
|
+
true
|
189
|
+
else
|
190
|
+
false
|
191
|
+
end
|
192
|
+
when :Object
|
193
|
+
# generic object (usually a Hash), return directly
|
194
|
+
value
|
195
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
196
|
+
inner_type = Regexp.last_match[:inner_type]
|
197
|
+
value.map { |v| _deserialize(inner_type, v) }
|
198
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
199
|
+
k_type = Regexp.last_match[:k_type]
|
200
|
+
v_type = Regexp.last_match[:v_type]
|
201
|
+
{}.tap do |hash|
|
202
|
+
value.each do |k, v|
|
203
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
else # model
|
207
|
+
# models (e.g. Pet) or oneOf
|
208
|
+
klass = Patch.const_get(type)
|
209
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
# Returns the string representation of the object
|
214
|
+
# @return [String] String presentation of the object
|
215
|
+
def to_s
|
216
|
+
to_hash.to_s
|
217
|
+
end
|
218
|
+
|
219
|
+
# to_body is an alias to to_hash (backward compatibility)
|
220
|
+
# @return [Hash] Returns the object in the form of hash
|
221
|
+
def to_body
|
222
|
+
to_hash
|
223
|
+
end
|
224
|
+
|
225
|
+
# Returns the object in the form of hash
|
226
|
+
# @return [Hash] Returns the object in the form of hash
|
227
|
+
def to_hash
|
228
|
+
hash = {}
|
229
|
+
self.class.attribute_map.each_pair do |attr, param|
|
230
|
+
value = self.send(attr)
|
231
|
+
if value.nil?
|
232
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
233
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
234
|
+
end
|
235
|
+
|
236
|
+
hash[param] = _to_hash(value)
|
237
|
+
end
|
238
|
+
hash
|
239
|
+
end
|
240
|
+
|
241
|
+
# Outputs non-array value in the form of hash
|
242
|
+
# For object, use to_hash. Otherwise, just return the value
|
243
|
+
# @param [Object] value Any valid value
|
244
|
+
# @return [Hash] Returns the value in the form of hash
|
245
|
+
def _to_hash(value)
|
246
|
+
if value.is_a?(Array)
|
247
|
+
value.compact.map { |v| _to_hash(v) }
|
248
|
+
elsif value.is_a?(Hash)
|
249
|
+
{}.tap do |hash|
|
250
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
251
|
+
end
|
252
|
+
elsif value.respond_to? :to_hash
|
253
|
+
value.to_hash
|
254
|
+
else
|
255
|
+
value
|
256
|
+
end
|
257
|
+
end
|
258
|
+
end
|
259
|
+
end
|
data/lib/patch_ruby/version.rb
CHANGED
data/lib/patch_ruby.rb
CHANGED
@@ -46,12 +46,14 @@ require 'patch_ruby/models/project_response'
|
|
46
46
|
require 'patch_ruby/models/sdg'
|
47
47
|
require 'patch_ruby/models/standard'
|
48
48
|
require 'patch_ruby/models/technology_type'
|
49
|
+
require 'patch_ruby/models/technology_type_list_response'
|
49
50
|
|
50
51
|
# APIs
|
51
52
|
require 'patch_ruby/api/estimates_api'
|
52
53
|
require 'patch_ruby/api/orders_api'
|
53
54
|
require 'patch_ruby/api/preferences_api'
|
54
55
|
require 'patch_ruby/api/projects_api'
|
56
|
+
require 'patch_ruby/api/technology_types_api'
|
55
57
|
|
56
58
|
module Patch
|
57
59
|
class << self
|
@@ -0,0 +1,46 @@
|
|
1
|
+
=begin
|
2
|
+
#Patch API V1
|
3
|
+
|
4
|
+
#The core API used to integrate with Patch's service
|
5
|
+
|
6
|
+
The version of the OpenAPI document: v1
|
7
|
+
Contact: developers@usepatch.com
|
8
|
+
Generated by: https://openapi-generator.tech
|
9
|
+
OpenAPI Generator version: 5.2.1
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'spec_helper'
|
14
|
+
require 'json'
|
15
|
+
|
16
|
+
# Unit tests for Patch::TechnologyTypesApi
|
17
|
+
# Automatically generated by openapi-generator (https://openapi-generator.tech)
|
18
|
+
# Please update as you see appropriate
|
19
|
+
describe 'TechnologyTypesApi' do
|
20
|
+
before do
|
21
|
+
# run before each test
|
22
|
+
@api_instance = Patch::TechnologyTypesApi.new
|
23
|
+
end
|
24
|
+
|
25
|
+
after do
|
26
|
+
# run after each test
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'test an instance of TechnologyTypesApi' do
|
30
|
+
it 'should create an instance of TechnologyTypesApi' do
|
31
|
+
expect(@api_instance).to be_instance_of(Patch::TechnologyTypesApi)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# unit tests for retrieve_technology_types
|
36
|
+
# Retrieves the list of technology_types
|
37
|
+
# Retrieves a list of all technology_types.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [TechnologyTypeListResponse]
|
40
|
+
describe 'retrieve_technology_types test' do
|
41
|
+
it 'should work' do
|
42
|
+
# assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
RSpec.describe "Projects TechnologyTypes Integration" do
|
4
|
+
it "returns a list of technology types and their parent types" do
|
5
|
+
technology_types = Patch::TechnologyType.retrieve_technology_types()
|
6
|
+
expect(technology_types.data.count).to be_positive
|
7
|
+
expect(technology_types.data.first.slug).to be_a(String)
|
8
|
+
expect(technology_types.data.first.name).to be_a(String)
|
9
|
+
|
10
|
+
parent = technology_types.data.first.parent_technology_type
|
11
|
+
expect(parent.slug).to be_a(String)
|
12
|
+
expect(parent.name).to be_a(String)
|
13
|
+
end
|
14
|
+
end
|
data/spec/models/project_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: patch_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patch Technology
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: typhoeus
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- lib/patch_ruby/api/orders_api.rb
|
98
98
|
- lib/patch_ruby/api/preferences_api.rb
|
99
99
|
- lib/patch_ruby/api/projects_api.rb
|
100
|
+
- lib/patch_ruby/api/technology_types_api.rb
|
100
101
|
- lib/patch_ruby/api_client.rb
|
101
102
|
- lib/patch_ruby/api_error.rb
|
102
103
|
- lib/patch_ruby/configuration.rb
|
@@ -129,12 +130,14 @@ files:
|
|
129
130
|
- lib/patch_ruby/models/sdg.rb
|
130
131
|
- lib/patch_ruby/models/standard.rb
|
131
132
|
- lib/patch_ruby/models/technology_type.rb
|
133
|
+
- lib/patch_ruby/models/technology_type_list_response.rb
|
132
134
|
- lib/patch_ruby/version.rb
|
133
135
|
- patch_ruby.gemspec
|
134
136
|
- spec/api/estimates_api_spec.rb
|
135
137
|
- spec/api/orders_api_spec.rb
|
136
138
|
- spec/api/preferences_api_spec.rb
|
137
139
|
- spec/api/projects_api_spec.rb
|
140
|
+
- spec/api/technology_types_api_spec.rb
|
138
141
|
- spec/api_client_spec.rb
|
139
142
|
- spec/configuration_spec.rb
|
140
143
|
- spec/constants.rb
|
@@ -162,6 +165,7 @@ files:
|
|
162
165
|
- spec/integration/estimates_spec.rb
|
163
166
|
- spec/integration/orders_spec.rb
|
164
167
|
- spec/integration/preferences_spec.rb
|
168
|
+
- spec/integration/projects/technology_types_spec.rb
|
165
169
|
- spec/integration/projects_spec.rb
|
166
170
|
- spec/models/allocation_spec.rb
|
167
171
|
- spec/models/create_mass_estimate_request_spec.rb
|
@@ -208,6 +212,7 @@ signing_key:
|
|
208
212
|
specification_version: 4
|
209
213
|
summary: Ruby wrapper for the Patch API
|
210
214
|
test_files:
|
215
|
+
- spec/api/technology_types_api_spec.rb
|
211
216
|
- spec/api/projects_api_spec.rb
|
212
217
|
- spec/api/estimates_api_spec.rb
|
213
218
|
- spec/api/preferences_api_spec.rb
|
@@ -239,6 +244,7 @@ test_files:
|
|
239
244
|
- spec/integration/estimates_spec.rb
|
240
245
|
- spec/integration/projects_spec.rb
|
241
246
|
- spec/integration/preferences_spec.rb
|
247
|
+
- spec/integration/projects/technology_types_spec.rb
|
242
248
|
- spec/integration/orders_spec.rb
|
243
249
|
- spec/models/create_order_request_spec.rb
|
244
250
|
- spec/models/project_list_response_spec.rb
|