-
Notifications
You must be signed in to change notification settings - Fork 148
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
v1.0.0 refactor #70
v1.0.0 refactor #70
Conversation
- export a constructor which accepts config - rewrite setConfig method - rewrite vows integration tests - add documentations - better separation between private methods and public ones
- configure travisCI to run unit tests - install mocha and should.js - write constructor test
@moshen this is the BIG refactory I prepared over the past months. It would be good to see what you think. I would need more stuff, but I figured that this is workable already. My plan is to use this on my production servers then promote it to npm v1.0.0 |
I noticed #71 and #72, but lib/elevationFromLocations.js also needs the same |
I have refactored this lib/elevationFromLocations.js so it accepts a params and callback like the other functions in the library. We could spent more time clean it completely and refactor Also once this is done there are changes that Google made to the |
Just noticed the You're right about refactoring the utils. Though, I think any API breaking changes should go in before release. |
I could work on the first three
|
FYI, pushed the config-key changes |
@moshen I refactored the staticMap, I have added plenty of unit tests because of all the many parameters, but I need to make the callback not mandatory for users that only need the URL Also I am not able to make it work with a path and |
Seems easy enough: remove this check, as you are already checking if In the original version any call could be made without a callback to simply return the uri (and not make the request). It certainly looks like that has changed. I guess the question is to make a
I'm not sure what the issue is. When I run the tests on both branches they seem to work. Do you mean just encoding for |
Yes, it is a fair use case to get the URI of the static map without the binary. The above commit makes that happen. The |
@moshen I pushed the last change as agreed, please have a look and let me know |
@fabriziomoscon , looks like you're doing a big refactor. Did you change |
@lastquestion That's a good question.
No.
It can be an addition to the api (optional), that could go into 1.1.0, trying to concentrate on api breaking changes for this release.
As far as I understand it, currently this isn't how it works. Only the request initiation times are staggered, the current implementation doesn't wait for requests to complete before initiating more. Also, waitress will probably be replaced by more standard usage of something like Promises (bluebird) or Observables (RxJS). Which would make these types of changes pretty easy. I don't know if the queuing of requests within the api is the way to go though, as the upcoming changes will make it easier to wrap the api yourself to throttle requests. @fabriziomoscon , thoughts? |
@moshen : from what I understand it only throttles on one specific kind of request My implementation also only staggered the requests, and didn't wait for replies, but it did it also for queries like I think you're right that if the request object or whatever is exposed, users can manage their wait/throttle/whatever themselves. Factoring it out from the library seems the right approach and simplifies code for everybody including clients. |
I agree with factoring out of this library any additional generic functionality such as backing off and queuing requests. Keeping the library to bare minimum will increase maintainability and reduce complexity. I think respecting the modularity principle which is at the at the core of @lastquestion, in regards to throttling keep in mind that users are able to negotiate custom quotas per APIs directly with Google in order to satisfy their business needs, therefore having a super generic config such as |
100% Correct
That's not really necessary. The bigger bonus is that the api calls will all have the format:
I think that this is the right way to go. Maybe including an example (at a later date) of throttling api calls without touching the api. |
@moshen I have tested few methods in my code base and so far I haven't found issues, unless you want to test more I would consider merging this code and release on npm |
Are there plans to merge this in anytime soon? |
Hi @serhalp it is in my list of TODOs to merge this, but if you have a production environment to deploy this branch to please go ahead so we have more than one production test. |
f329403
to
821b903
Compare
- use new endpoint `/maps/api/place/nearbysearch/json` - added unit test for it - require `check-types` - accept all the latest place search parameters from Google - make callback mandatory
- accept parameters, and check for mandatory ones - make callback mandatory - unit test - add mock json objects for placeDetails and placeSearch
- pass params to functions - change `console-key` to `key` - change README example for reverseGeocode
- pass params to distance - move intenal modules into separate files - mode api implementations into separate files - mode constants into a JSON file
- accept params and callback rather than tens of parameters - add parameter combination logic to prevent invalid API use - add a valid public browser key to tests
…/long on Google end
- add check for mandatory parameters for geocode and reverseGeocode api
Changes: - encode-polylines to encode_polylines - google-client-id to google_client_id - stagger-time to stagger_time - google-private-key to google_private_key
- change signature into params, callback - making callback mandatory - adding unit test - removing obsolete parameter sensor
- also fix markers - update README
- add unit test - update README
fix typo and add util mergeParams unit test
fb9b54e
to
eecf812
Compare
- constructor - geocoding - reverse geocoding
eecf812
to
76e0c68
Compare
No description provided.