Skip to content

Commit

Permalink
Merge pull request #39 from barkibu/fix/breeds_def_changes
Browse files Browse the repository at this point in the history
Breeds - Adjust attributes definition to the PetFamily exposed ones
  • Loading branch information
malkovro authored Jul 5, 2021
2 parents 0202c39 + 03d204b commit 80599f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.4.4]
- Breeds - Adjust fields definition to petfamily domain ones

## [0.4.3]
- Breeds - Change client resolver template to use petfamily domain

Expand Down Expand Up @@ -73,7 +76,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [0.1.1] - 2020-01-12
- Init Version: Breeds and limited PetParents/Consultations

[Unreleased]: https://github.com/barkibu/kb-ruby/compare/v0.4.3...HEAD
[Unreleased]: https://github.com/barkibu/kb-ruby/compare/v0.4.4...HEAD
[0.4.4]: https://github.com/barkibu/kb-ruby/compare/v0.4.3...v0.4.4
[0.4.3]: https://github.com/barkibu/kb-ruby/compare/v0.4.2...v0.4.3
[0.4.2]: https://github.com/barkibu/kb-ruby/compare/v0.4.1...v0.4.2
[0.4.1]: https://github.com/barkibu/kb-ruby/compare/v0.4.0...v0.4.1
Expand Down
19 changes: 2 additions & 17 deletions lib/kb/models/breed.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,15 @@ def self.attributes_from_response(response)

private_class_method :attributes_from_response

STRING_FIELDS = %i[key breed_parent_key weight_group species].freeze
INTEGER_FIELDS = %i[risk].freeze
DECIMAL_FIELDS = %i[weight_min weight_max lifespan].freeze
ARRAY_FIELDS = %i[names].freeze
FIELDS = [*STRING_FIELDS, *INTEGER_FIELDS, *DECIMAL_FIELDS, *ARRAY_FIELDS].freeze
STRING_FIELDS = %i[key locale name species weight_group].freeze
FIELDS = [*STRING_FIELDS].freeze

define_attribute_methods(*FIELDS)

STRING_FIELDS.each do |field|
attribute field, :string
end

INTEGER_FIELDS.each do |field|
attribute field, :integer
end

DECIMAL_FIELDS.each do |field|
attribute field, :decimal
end

ARRAY_FIELDS.each do |field|
attribute field, :array_of_strings, default: []
end

FIELDS.each do |field|
define_method :"#{field}=" do |value|
public_send "#{field}_will_change!"
Expand Down
2 changes: 1 addition & 1 deletion lib/kb/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module KB
VERSION = '0.4.3'.freeze
VERSION = '0.4.4'.freeze
end

0 comments on commit 80599f3

Please sign in to comment.