Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't save fields with _ #29

Open
brenes opened this issue Aug 19, 2014 · 5 comments
Open

Can't save fields with _ #29

brenes opened this issue Aug 19, 2014 · 5 comments

Comments

@brenes
Copy link

brenes commented Aug 19, 2014

Hi,

We have created some utm custom fields (utm_campaign, utm_term...) in our zoho but we are not being able to populate them from the API.

We noticed that when the XML to be sent to the API is generated those fields have changed to a capitalized version (Utm Source, Utm Term...) due to the ApiUtils#symbol_to_string method, so although they are sent to Zoho they are not saved (it doesn't trigger any error either).

I was thinking that could be useful creating some kind of "memory" for translations. This way, the string_to_method_name could save that utm_source translates as utm_source, and the symbol_to_string method could recover that translation and send utm_source.

This memory could be created at the RubyZoho::Crm::Lead level.

What do you think?

@amalc
Copy link
Owner

amalc commented Aug 19, 2014

It's a good idea. I'd started on a "map" to manage this and other issues,
like non ruby legal field names. But haven't got a chance to finish it.

The thought was to cache the Zoho name inbound, and create a legal Ruby
name and convert it back on the way out.

I think its at the "api" level in the source.

On Tue, Aug 19, 2014 at 2:06 PM, brenes [email protected] wrote:

Hi,

We have created some utm custom fields (utm_campaign, urm_term...) in our
zoho but we are not being able to populate them from the API.

We noticed that when the XML to be sent to the API is generated those
fields have changed to a capitalized version (Utm Source, Utm Term...) due
to the ApiUtils#symbol_to_string method, so although they are sent to Zoho
they are not saved (it doesn't trigger any error either).

I was thinking that could be useful creating some kind of "memory" for
translations. This way, the string_to_method_name could save that
utm_source translates as utm_source, and the symbol_to_string method could
recover that translation and send utm_source.

This memory could be created at the RubyZoho::Crm::Lead level.

What do you think?


Reply to this email directly or view it on GitHub
#29.

@brenes
Copy link
Author

brenes commented Aug 19, 2014

Browing in the code I'm seeing that maybe the right place to touch would be the ZohoApiFieldUtils#extract_field method. This way the translation could be stored at a module level.

Then we could check for the translation in the ZohoApiFieldUtils#add_field method and rewrite it properly in the XML.

I think I will give it a try and let you know (hopefully with a PR if everything goes fine ).

@amalc
Copy link
Owner

amalc commented Aug 19, 2014

Yup, exactly!

On Tue, Aug 19, 2014 at 2:26 PM, brenes [email protected] wrote:

Browing in the code I'm seeing that maybe the right place to touch would
be the ZohoApiFieldUtils#extract_field method. This way the translation
could be stored at a module level.

Then we could check for the translation in the ZohoApiFieldUtils#add_field
method and rewrite it properly in the XML.

I think I will give it a try and let you know (hopefully with a PR if
everything goes fine ).


Reply to this email directly or view it on GitHub
#29 (comment).

@brenes
Copy link
Author

brenes commented Aug 19, 2014

I published a PR right now. As I comment in the PR I couldn't find a way to properly test this translation as I can't use my Zoho API Key with testing purposes.

Is there any test API Key that could be used? Should I mock all the API calls?

Thanks!

@amalc
Copy link
Owner

amalc commented Feb 22, 2015

Sorry I didn't see this. We have a test Zoho account for testing. And we're very careful about API usage.

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

No branches or pull requests

2 participants