Skip to content
This repository was archived by the owner on Jun 30, 2020. It is now read-only.

Using [] should give the same result than the accessor#6

Merged
jplot merged 1 commit into
lounna-team:masterfrom
fonji:consistency_between_accessors_and_hash_method
Dec 31, 2019
Merged

Using [] should give the same result than the accessor#6
jplot merged 1 commit into
lounna-team:masterfrom
fonji:consistency_between_accessors_and_hash_method

Conversation

@fonji

@fonji fonji commented Dec 19, 2019

Copy link
Copy Markdown

Currently, this is what happens

contact = Hubspot::Contact.find(id)
contact[:firstname]
# => {"value"=>"Bruce", "versions"=>[redacted]} 
contact.firstname
# => "Bruce"

Which is already inconsistent but how about this?

contact = Hubspot::Contact.new(firstname: 'Bruce')
contact[:firstname]
# => 'Bruce'
contact.firstname
# => "Bruce"

This PR fixes this by having #[] always giving the value.

Upstream PR: HubspotCommunity#218

@jplot jplot merged commit 2f46b7f into lounna-team:master Dec 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants