Skip to content

Commit ccfdab0

Browse files
authored
Adds mechanism, tagline, state, latitude, longitude, and technology_type to project responses (#47)
1 parent 7eba5a2 commit ccfdab0

15 files changed

+641
-12
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
- [ ] Have you added an integration test for the changes?
1212
- [ ] Have you built the gem locally and made queries against it successfully?
1313
- [ ] Did you update the changelog?
14-
- [ ] Did you bump the package version?
14+
- [ ] Did you bump the package version [in the code generator](https://github.com/patch-technology/client-code-generation/blob/main/configs/ruby-config.json#L11-L12)?
1515
- [ ] For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.14.0] - 2021-09-21
9+
10+
### Added
11+
12+
- Adds mechanism, tagline, state, latitude, longitude, and technology_type to project responses
13+
814
## [1.13.0] - 2021-09-10
915

1016
### Added

Gemfile.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
patch_ruby (1.13.0)
4+
patch_ruby (1.14.0)
55
typhoeus (~> 1.0, >= 1.0.1)
66

77
GEM

lib/patch_ruby.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
require 'patch_ruby/models/order'
3636
require 'patch_ruby/models/order_list_response'
3737
require 'patch_ruby/models/order_response'
38+
require 'patch_ruby/models/parent_technology_type'
3839
require 'patch_ruby/models/photo'
3940
require 'patch_ruby/models/preference'
4041
require 'patch_ruby/models/preference_list_response'
@@ -44,6 +45,7 @@
4445
require 'patch_ruby/models/project_response'
4546
require 'patch_ruby/models/sdg'
4647
require 'patch_ruby/models/standard'
48+
require 'patch_ruby/models/technology_type'
4749

4850
# APIs
4951
require 'patch_ruby/api/estimates_api'

lib/patch_ruby/api_client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class ApiClient
3131
# @option config [Configuration] Configuration for initializing the object, default to Configuration.default
3232
def initialize(config = Configuration.default)
3333
@config = config
34-
@user_agent = "patch-ruby/1.13.0"
34+
@user_agent = "patch-ruby/1.14.0"
3535
@default_headers = {
3636
'Content-Type' => 'application/json',
3737
'User-Agent' => @user_agent
Lines changed: 239 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,239 @@
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+
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 ParentTechnologyType
18+
# Unique identifier for this type of technology.
19+
attr_accessor :slug
20+
21+
# Name of this technology type.
22+
attr_accessor :name
23+
24+
# Attribute mapping from ruby-style variable name to JSON key.
25+
def self.attribute_map
26+
{
27+
:'slug' => :'slug',
28+
:'name' => :'name'
29+
}
30+
end
31+
32+
# Returns all the JSON keys this model knows about
33+
def self.acceptable_attributes
34+
attribute_map.values
35+
end
36+
37+
# Attribute type mapping.
38+
def self.openapi_types
39+
{
40+
:'slug' => :'String',
41+
:'name' => :'String'
42+
}
43+
end
44+
45+
# List of attributes with nullable: true
46+
def self.openapi_nullable
47+
Set.new([
48+
])
49+
end
50+
51+
52+
# Allows models with corresponding API classes to delegate API operations to those API classes
53+
# Exposes Model.operation_id which delegates to ModelsApi.new.operation_id
54+
# Eg. Order.create_order delegates to OrdersApi.new.create_order
55+
def self.method_missing(message, *args, &block)
56+
if Object.const_defined?('Patch::ParentTechnologyTypesApi::OPERATIONS') && Patch::ParentTechnologyTypesApi::OPERATIONS.include?(message)
57+
Patch::ParentTechnologyTypesApi.new.send(message, *args)
58+
else
59+
super
60+
end
61+
end
62+
63+
# Initializes the object
64+
# @param [Hash] attributes Model attributes in the form of hash
65+
def initialize(attributes = {})
66+
if (!attributes.is_a?(Hash))
67+
fail ArgumentError, "The input argument (attributes) must be a hash in `Patch::ParentTechnologyType` initialize method"
68+
end
69+
70+
# check to see if the attribute exists and convert string to symbol for hash key
71+
attributes = attributes.each_with_object({}) { |(k, v), h|
72+
if (!self.class.attribute_map.key?(k.to_sym))
73+
fail ArgumentError, "`#{k}` is not a valid attribute in `Patch::ParentTechnologyType`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
74+
end
75+
h[k.to_sym] = v
76+
}
77+
78+
if attributes.key?(:'slug')
79+
self.slug = attributes[:'slug']
80+
end
81+
82+
if attributes.key?(:'name')
83+
self.name = attributes[:'name']
84+
end
85+
end
86+
87+
# Show invalid properties with the reasons. Usually used together with valid?
88+
# @return Array for valid properties with the reasons
89+
def list_invalid_properties
90+
invalid_properties = Array.new
91+
invalid_properties
92+
end
93+
94+
# Check to see if the all the properties in the model are valid
95+
# @return true if the model is valid
96+
def valid?
97+
true
98+
end
99+
100+
# Checks equality by comparing each attribute.
101+
# @param [Object] Object to be compared
102+
def ==(o)
103+
return true if self.equal?(o)
104+
self.class == o.class &&
105+
slug == o.slug &&
106+
name == o.name
107+
end
108+
109+
# @see the `==` method
110+
# @param [Object] Object to be compared
111+
def eql?(o)
112+
self == o
113+
end
114+
115+
# Calculates hash code according to all attributes.
116+
# @return [Integer] Hash code
117+
def hash
118+
[slug, name].hash
119+
end
120+
121+
# Builds the object from hash
122+
# @param [Hash] attributes Model attributes in the form of hash
123+
# @return [Object] Returns the model itself
124+
def self.build_from_hash(attributes)
125+
new.build_from_hash(attributes)
126+
end
127+
128+
# Builds the object from hash
129+
# @param [Hash] attributes Model attributes in the form of hash
130+
# @return [Object] Returns the model itself
131+
def build_from_hash(attributes)
132+
return nil unless attributes.is_a?(Hash)
133+
self.class.openapi_types.each_pair do |key, type|
134+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
135+
self.send("#{key}=", nil)
136+
elsif type =~ /\AArray<(.*)>/i
137+
# check to ensure the input is an array given that the attribute
138+
# is documented as an array but the input is not
139+
if attributes[self.class.attribute_map[key]].is_a?(Array)
140+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
141+
end
142+
elsif !attributes[self.class.attribute_map[key]].nil?
143+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144+
end
145+
end
146+
147+
self
148+
end
149+
150+
# Deserializes the data based on type
151+
# @param string type Data type
152+
# @param string value Value to be deserialized
153+
# @return [Object] Deserialized data
154+
def _deserialize(type, value)
155+
case type.to_sym
156+
when :Time
157+
Time.parse(value)
158+
when :Date
159+
Date.parse(value)
160+
when :String
161+
value.to_s
162+
when :Integer
163+
value.to_i
164+
when :Float
165+
value.to_f
166+
when :Boolean
167+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168+
true
169+
else
170+
false
171+
end
172+
when :Object
173+
# generic object (usually a Hash), return directly
174+
value
175+
when /\AArray<(?<inner_type>.+)>\z/
176+
inner_type = Regexp.last_match[:inner_type]
177+
value.map { |v| _deserialize(inner_type, v) }
178+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179+
k_type = Regexp.last_match[:k_type]
180+
v_type = Regexp.last_match[:v_type]
181+
{}.tap do |hash|
182+
value.each do |k, v|
183+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184+
end
185+
end
186+
else # model
187+
# models (e.g. Pet) or oneOf
188+
klass = Patch.const_get(type)
189+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
190+
end
191+
end
192+
193+
# Returns the string representation of the object
194+
# @return [String] String presentation of the object
195+
def to_s
196+
to_hash.to_s
197+
end
198+
199+
# to_body is an alias to to_hash (backward compatibility)
200+
# @return [Hash] Returns the object in the form of hash
201+
def to_body
202+
to_hash
203+
end
204+
205+
# Returns the object in the form of hash
206+
# @return [Hash] Returns the object in the form of hash
207+
def to_hash
208+
hash = {}
209+
self.class.attribute_map.each_pair do |attr, param|
210+
value = self.send(attr)
211+
if value.nil?
212+
is_nullable = self.class.openapi_nullable.include?(attr)
213+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
214+
end
215+
216+
hash[param] = _to_hash(value)
217+
end
218+
hash
219+
end
220+
221+
# Outputs non-array value in the form of hash
222+
# For object, use to_hash. Otherwise, just return the value
223+
# @param [Object] value Any valid value
224+
# @return [Hash] Returns the value in the form of hash
225+
def _to_hash(value)
226+
if value.is_a?(Array)
227+
value.compact.map { |v| _to_hash(v) }
228+
elsif value.is_a?(Hash)
229+
{}.tap do |hash|
230+
value.each { |k, v| hash[k] = _to_hash(v) }
231+
end
232+
elsif value.respond_to? :to_hash
233+
value.to_hash
234+
else
235+
value
236+
end
237+
end
238+
end
239+
end

0 commit comments

Comments
 (0)