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 intolounna-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 intolounna-team:masterfrom
fonji:consistency_between_accessors_and_hash_method

Conversation

@fonji
Copy link
Copy Markdown

@fonji fonji commented Dec 19, 2019

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