Skip to content

Commit 099f7b3

Browse files
author
Chadwick Banning
committed
Account for new attributes returned from the API and normalize them
1 parent 318ae82 commit 099f7b3

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

lib/puppet_forge_server/models/builder.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,12 @@ module PuppetForgeServer::Models
1818
class Builder
1919
def initialize(attributes={})
2020
attributes.each do |name, value|
21-
send("#{name}=", value) unless value.to_s.empty?
21+
if name.to_s == 'decription'
22+
normalized_name = :description
23+
else
24+
normalized_name = name.to_s.tr('-', '_').to_sym
25+
end
26+
send("#{normalized_name}=", value) unless value.to_s.empty?
2227
end
2328
end
2429

lib/puppet_forge_server/models/metadata.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,24 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
1817
module PuppetForgeServer::Models
1918
class Metadata < Builder
20-
2119
attr_accessor :author, :name, :version, :dependencies, :summary, :description, :project_page, :types
2220
attr_accessor :checksums, :source, :license, :issues_url, :operatingsystem_support, :requirements
2321
attr_accessor :puppet_version, :tags, :mail, :classes, :definitions
22+
attr_accessor :pdk_version, :template_url, :template_ref, :data_provider, :docs_project
23+
attr_accessor :forge_url, :package_release_version, :issue_url
24+
attr_accessor :kpn_quality_label, :kpn_module_owner, :kpn_module_support
2425

2526
def initialize(attributes)
2627
super(attributes)
2728
end
2829

2930
def ==(other)
3031
other && self.class.equal?(other.class) &&
31-
@author == other.author &&
32-
@name == other.name &&
33-
@version == other.version
32+
@author == other.author &&
33+
@name == other.name &&
34+
@version == other.version
3435
end
3536

3637
def hash
@@ -39,9 +40,9 @@ def hash
3940

4041
def eql?(other)
4142
other && self.class.equal?(other.class) &&
42-
@author.eql?(other.author) &&
43-
@name.eql?(other.name) &&
44-
@version.eql?(other.version)
43+
@author.eql?(other.author) &&
44+
@name.eql?(other.name) &&
45+
@version.eql?(other.version)
4546
end
4647
end
4748
end

0 commit comments

Comments
 (0)