Skip to content

Comments

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

Open
fonji wants to merge 1 commit intoHubspotCommunity:masterfrom
fonji:consistency_between_accessors_and_hash_method
Open

Using [] should give the same result than the accessor#218
fonji wants to merge 1 commit intoHubspotCommunity:masterfrom
fonji:consistency_between_accessors_and_hash_method

Conversation

@fonji
Copy link
Contributor

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant