trimble_maps 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +38 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.gitignore +11 -0
- data/.idea/.gitignore +8 -0
- data/.idea/.rakeTasks +7 -0
- data/.idea/dictionaries/shawnwilson.xml +8 -0
- data/.idea/misc.xml +7 -0
- data/.idea/modules.xml +8 -0
- data/.idea/trimble_maps.iml +27 -0
- data/.idea/vcs.xml +6 -0
- data/.rakeTasks +7 -0
- data/.rspec +3 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.md +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +7 -0
- data/Gemfile.lock +42 -0
- data/README.md +71 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/trimble_maps.rb +24 -0
- data/lib/trimble_maps/configuration.rb +10 -0
- data/lib/trimble_maps/location.rb +37 -0
- data/lib/trimble_maps/version.rb +3 -0
- data/trimble_maps.gemspec +28 -0
- metadata +85 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 83cbe179b5c56d2a74650ebde9b62e4536c290a000ff1c76e13113535020a5dc
|
|
4
|
+
data.tar.gz: b177072bfa6fd70aef50bddcbc54c11bbd9ffc9349b343f921c2fd1cf58e8cc9
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 14257427750e4966e8215a692b259103e6c5eea702a8dca6d541f4cb66a2ff746e97c7e06b106b2f4eb038f1df6fae0369ce6cd8cefff47251ff7181b9bfa6ce
|
|
7
|
+
data.tar.gz: 60d4a38d0a177a5e46b3f11f85af8ef204bcbf39978c1eebc182e25b7610b9159d8578b10c453e0a8d04a1cd4704dcb21afa4ebf70428c76ad76763e887660bf
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Create a report to help us improve
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Describe the bug**
|
|
11
|
+
A clear and concise description of what the bug is.
|
|
12
|
+
|
|
13
|
+
**To Reproduce**
|
|
14
|
+
Steps to reproduce the behavior:
|
|
15
|
+
1. Go to '...'
|
|
16
|
+
2. Click on '....'
|
|
17
|
+
3. Scroll down to '....'
|
|
18
|
+
4. See error
|
|
19
|
+
|
|
20
|
+
**Expected behavior**
|
|
21
|
+
A clear and concise description of what you expected to happen.
|
|
22
|
+
|
|
23
|
+
**Screenshots**
|
|
24
|
+
If applicable, add screenshots to help explain your problem.
|
|
25
|
+
|
|
26
|
+
**Desktop (please complete the following information):**
|
|
27
|
+
- OS: [e.g. iOS]
|
|
28
|
+
- Browser [e.g. chrome, safari]
|
|
29
|
+
- Version [e.g. 22]
|
|
30
|
+
|
|
31
|
+
**Smartphone (please complete the following information):**
|
|
32
|
+
- Device: [e.g. iPhone6]
|
|
33
|
+
- OS: [e.g. iOS8.1]
|
|
34
|
+
- Browser [e.g. stock browser, safari]
|
|
35
|
+
- Version [e.g. 22]
|
|
36
|
+
|
|
37
|
+
**Additional context**
|
|
38
|
+
Add any other context about the problem here.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature request
|
|
3
|
+
about: Suggest an idea for this project
|
|
4
|
+
title: ''
|
|
5
|
+
labels: ''
|
|
6
|
+
assignees: ''
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
|
12
|
+
|
|
13
|
+
**Describe the solution you'd like**
|
|
14
|
+
A clear and concise description of what you want to happen.
|
|
15
|
+
|
|
16
|
+
**Describe alternatives you've considered**
|
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
|
18
|
+
|
|
19
|
+
**Additional context**
|
|
20
|
+
Add any other context or screenshots about the feature request here.
|
data/.gitignore
ADDED
data/.idea/.gitignore
ADDED
data/.idea/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake"><RakeTask description="Build trimble_maps-0.1.0.gem into the pkg directory" fullCmd="build" taksId="build" /><RakeTask description="Remove any temporary products" fullCmd="clean" taksId="clean" /><RakeTask description="Remove any generated files" fullCmd="clobber" taksId="clobber" /><RakeTask description="Build and install trimble_maps-0.1.0.gem into system gems" fullCmd="install" taksId="install" /><RakeGroup description="" fullCmd="" taksId="install"><RakeTask description="Build and install trimble_maps-0.1.0.gem into system gems without network access" fullCmd="install:local" taksId="local" /></RakeGroup><RakeTask description="Create tag v0.1.0 and build and push trimble_maps-0.1.0.gem to rubygems.org" fullCmd="release[remote]" taksId="release[remote]" /><RakeTask description="Run RSpec code examples" fullCmd="spec" taksId="spec" /><RakeTask description="" fullCmd="default" taksId="default" /><RakeTask description="" fullCmd="release" taksId="release" /><RakeGroup description="" fullCmd="" taksId="release"><RakeTask description="" fullCmd="release:guard_clean" taksId="guard_clean" /><RakeTask description="" fullCmd="release:rubygem_push" taksId="rubygem_push" /><RakeTask description="" fullCmd="release:source_control_push" taksId="source_control_push" /></RakeGroup></RakeGroup></Settings>
|
data/.idea/misc.xml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="JavaScriptSettings">
|
|
4
|
+
<option name="languageLevel" value="ES6" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 2.7.1" project-jdk-type="RUBY_SDK" />
|
|
7
|
+
</project>
|
data/.idea/modules.xml
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/trimble_maps.iml" filepath="$PROJECT_DIR$/.idea/trimble_maps.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="RUBY_MODULE" version="4">
|
|
3
|
+
<component name="ModuleRunConfigurationManager">
|
|
4
|
+
<shared />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="NewModuleRootManager">
|
|
7
|
+
<content url="file://$MODULE_DIR$">
|
|
8
|
+
<sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
|
|
9
|
+
<sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
|
|
10
|
+
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
|
|
11
|
+
</content>
|
|
12
|
+
<orderEntry type="inheritedJdk" />
|
|
13
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
14
|
+
<orderEntry type="library" scope="PROVIDED" name="bundler (v2.1.4, rbenv: 2.7.1) [gem]" level="application" />
|
|
15
|
+
<orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.4.4, rbenv: 2.7.1) [gem]" level="application" />
|
|
16
|
+
<orderEntry type="library" scope="PROVIDED" name="httparty (v0.18.1, rbenv: 2.7.1) [gem]" level="application" />
|
|
17
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types (v3.3.1, rbenv: 2.7.1) [gem]" level="application" />
|
|
18
|
+
<orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2020.0512, rbenv: 2.7.1) [gem]" level="application" />
|
|
19
|
+
<orderEntry type="library" scope="PROVIDED" name="multi_xml (v0.6.0, rbenv: 2.7.1) [gem]" level="application" />
|
|
20
|
+
<orderEntry type="library" scope="PROVIDED" name="rake (v12.3.3, rbenv: 2.7.1) [gem]" level="application" />
|
|
21
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec (v3.9.0, rbenv: 2.7.1) [gem]" level="application" />
|
|
22
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.9.2, rbenv: 2.7.1) [gem]" level="application" />
|
|
23
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.9.2, rbenv: 2.7.1) [gem]" level="application" />
|
|
24
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.9.1, rbenv: 2.7.1) [gem]" level="application" />
|
|
25
|
+
<orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.9.3, rbenv: 2.7.1) [gem]" level="application" />
|
|
26
|
+
</component>
|
|
27
|
+
</module>
|
data/.idea/vcs.xml
ADDED
data/.rakeTasks
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<Settings><!--This file was automatically generated by Ruby plugin.
|
|
3
|
+
You are allowed to:
|
|
4
|
+
1. Remove rake task
|
|
5
|
+
2. Add existing rake tasks
|
|
6
|
+
To add existing rake tasks automatically delete this file and reload the project.
|
|
7
|
+
--><RakeGroup description="" fullCmd="" taksId="rake" /></Settings>
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# CHANGELOG
|
data/CODE_OF_CONDUCT.md
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
|
2
|
+
|
|
3
|
+
## Our Pledge
|
|
4
|
+
|
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
|
10
|
+
orientation.
|
|
11
|
+
|
|
12
|
+
## Our Standards
|
|
13
|
+
|
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
|
15
|
+
include:
|
|
16
|
+
|
|
17
|
+
* Using welcoming and inclusive language
|
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
|
19
|
+
* Gracefully accepting constructive criticism
|
|
20
|
+
* Focusing on what is best for the community
|
|
21
|
+
* Showing empathy towards other community members
|
|
22
|
+
|
|
23
|
+
Examples of unacceptable behavior by participants include:
|
|
24
|
+
|
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
|
26
|
+
advances
|
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
|
28
|
+
* Public or private harassment
|
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
|
30
|
+
address, without explicit permission
|
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
|
32
|
+
professional setting
|
|
33
|
+
|
|
34
|
+
## Our Responsibilities
|
|
35
|
+
|
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
|
38
|
+
response to any instances of unacceptable behavior.
|
|
39
|
+
|
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
|
44
|
+
threatening, offensive, or harmful.
|
|
45
|
+
|
|
46
|
+
## Scope
|
|
47
|
+
|
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
|
49
|
+
when an individual is representing the project or its community. Examples of
|
|
50
|
+
representing a project or community include using an official project e-mail
|
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
|
53
|
+
further defined and clarified by project maintainers.
|
|
54
|
+
|
|
55
|
+
## Enforcement
|
|
56
|
+
|
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
+
reported by contacting the project team at swilson@hammer-lane-industries.com. All
|
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
|
63
|
+
|
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
|
66
|
+
members of the project's leadership.
|
|
67
|
+
|
|
68
|
+
## Attribution
|
|
69
|
+
|
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
|
72
|
+
|
|
73
|
+
[homepage]: https://contributor-covenant.org
|
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
PATH
|
|
2
|
+
remote: .
|
|
3
|
+
specs:
|
|
4
|
+
trimble_maps (0.1.0)
|
|
5
|
+
httparty (= 0.18.1)
|
|
6
|
+
|
|
7
|
+
GEM
|
|
8
|
+
remote: https://rubygems.org/
|
|
9
|
+
specs:
|
|
10
|
+
diff-lcs (1.4.4)
|
|
11
|
+
httparty (0.18.1)
|
|
12
|
+
mime-types (~> 3.0)
|
|
13
|
+
multi_xml (>= 0.5.2)
|
|
14
|
+
mime-types (3.3.1)
|
|
15
|
+
mime-types-data (~> 3.2015)
|
|
16
|
+
mime-types-data (3.2020.0512)
|
|
17
|
+
multi_xml (0.6.0)
|
|
18
|
+
rake (12.3.3)
|
|
19
|
+
rspec (3.9.0)
|
|
20
|
+
rspec-core (~> 3.9.0)
|
|
21
|
+
rspec-expectations (~> 3.9.0)
|
|
22
|
+
rspec-mocks (~> 3.9.0)
|
|
23
|
+
rspec-core (3.9.2)
|
|
24
|
+
rspec-support (~> 3.9.3)
|
|
25
|
+
rspec-expectations (3.9.2)
|
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
27
|
+
rspec-support (~> 3.9.0)
|
|
28
|
+
rspec-mocks (3.9.1)
|
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
|
30
|
+
rspec-support (~> 3.9.0)
|
|
31
|
+
rspec-support (3.9.3)
|
|
32
|
+
|
|
33
|
+
PLATFORMS
|
|
34
|
+
ruby
|
|
35
|
+
|
|
36
|
+
DEPENDENCIES
|
|
37
|
+
rake (~> 12.0)
|
|
38
|
+
rspec (~> 3.0)
|
|
39
|
+
trimble_maps!
|
|
40
|
+
|
|
41
|
+
BUNDLED WITH
|
|
42
|
+
2.1.4
|
data/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# TrimbleMaps
|
|
2
|
+
|
|
3
|
+
Trimble Maps Gem is not in anyway supported by or connected to Trimble, its partners or subsidiaries in any way.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
Add this line to your application's Gemfile:
|
|
8
|
+
|
|
9
|
+
```ruby
|
|
10
|
+
gem 'trimble_maps'
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
And then execute:
|
|
14
|
+
|
|
15
|
+
$ bundle install
|
|
16
|
+
|
|
17
|
+
Or install it yourself as:
|
|
18
|
+
|
|
19
|
+
$ gem install trimble_maps
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
To use this gem you will need to obtain an API Key from Trimble you can [get one here](https://developer.trimblemaps.com/).
|
|
24
|
+
|
|
25
|
+
You can reference their docs [here](https://developer.trimblemaps.com/restful-apis/developer-guide/introduction/)
|
|
26
|
+
|
|
27
|
+
Once you have you API key issued (usually a few minutes) add it to your credentials file (in this example were using rails 6 credentials)
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
EDITOR="nano -w" rails credentials:edit
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Add this to your credentials.yml
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
trimble:
|
|
37
|
+
api_key: 'YOUR KEY HERE'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
You should then be able to access it in rails console like so
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
Rails.application.credentials[:trimble][:api_key]
|
|
44
|
+
|
|
45
|
+
returns => 'YOUR KEY HERE'
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
After your key is saved to your credentials create an initializer in: `config/initializers/trimble.rb` and add the following:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
TrimbleMaps.configure do |config|
|
|
52
|
+
config.api_key = Rails.application.credentials[:trimble][:api_key]
|
|
53
|
+
end
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Checkout our Wiki for module [examples](https://github.com/Hammer-Lane-Industries/trimble_maps/wiki)
|
|
57
|
+
|
|
58
|
+
## Development
|
|
59
|
+
|
|
60
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
|
61
|
+
|
|
62
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
|
63
|
+
|
|
64
|
+
## Contributing
|
|
65
|
+
|
|
66
|
+
Bug reports and pull requests are welcome [here](https://github.com/Hammer-Lane-Industries/trimble_maps/issues). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/Hammer-Lane-Industries/trimble_maps/blob/master/CODE_OF_CONDUCT.md).
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
## Code of Conduct
|
|
70
|
+
|
|
71
|
+
Everyone interacting in the TrimbleMaps project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Hammer-Lane-Industries/trimble_maps/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+
require "bundler/setup"
|
|
4
|
+
require "trimble_maps"
|
|
5
|
+
|
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
|
8
|
+
|
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
|
10
|
+
# require "pry"
|
|
11
|
+
# Pry.start
|
|
12
|
+
|
|
13
|
+
require "irb"
|
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/trimble_maps.rb
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require 'trimble_maps/version'
|
|
2
|
+
require 'trimble_maps/configuration'
|
|
3
|
+
require 'trimble_maps/location'
|
|
4
|
+
|
|
5
|
+
module TrimbleMaps
|
|
6
|
+
class Error < StandardError; end
|
|
7
|
+
|
|
8
|
+
class << self
|
|
9
|
+
attr_accessor :configuration
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def self.configuration
|
|
13
|
+
@configuration ||= Configuration.new
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def self.reset
|
|
17
|
+
@configuration = Configuration.new
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def self.configure
|
|
21
|
+
yield(configuration)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'httparty'
|
|
2
|
+
|
|
3
|
+
module TrimbleMaps
|
|
4
|
+
class Location
|
|
5
|
+
include HTTParty
|
|
6
|
+
|
|
7
|
+
base_uri 'https://pcmiler.alk.com/apis/rest/v1.0/service.svc'
|
|
8
|
+
|
|
9
|
+
def geocode(street:, city:, state:, postcode:, country:)
|
|
10
|
+
raise ArgumentError, 'Street is required' unless street.is_a?(String)
|
|
11
|
+
|
|
12
|
+
query = {
|
|
13
|
+
street: street,
|
|
14
|
+
city: city,
|
|
15
|
+
postcode: postcode,
|
|
16
|
+
state: state,
|
|
17
|
+
country: country
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
# GET /locations?street=whatever&city=&postcode=
|
|
21
|
+
response = self.class.get('/locations', query: query, headers: headers)
|
|
22
|
+
|
|
23
|
+
if response.success? && response.parsed_response.is_a?(Array)
|
|
24
|
+
response.parsed_response.first
|
|
25
|
+
else
|
|
26
|
+
# handle error response
|
|
27
|
+
# response.parsed_response['Error']
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
private
|
|
32
|
+
|
|
33
|
+
def headers
|
|
34
|
+
{ 'Authorization' => TrimbleMaps.configuration.api_key, 'Content-Type': 'application/json' }
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
require_relative 'lib/trimble_maps/version'
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |spec|
|
|
4
|
+
spec.name = 'trimble_maps'
|
|
5
|
+
spec.version = TrimbleMaps::VERSION
|
|
6
|
+
spec.authors = ['TheMindlessDevCanada']
|
|
7
|
+
spec.email = ['swilson@hammer-lane-industries.com']
|
|
8
|
+
|
|
9
|
+
spec.summary = 'Unofficial api wrapper for Trimble Maps'
|
|
10
|
+
spec.description = 'Unofficial api wrapper for Trimble Maps'
|
|
11
|
+
spec.homepage = 'https://github.com/Hammer-Lane-Industries/trimble_maps'
|
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
|
13
|
+
|
|
14
|
+
spec.metadata['homepage_uri'] = spec.homepage
|
|
15
|
+
spec.metadata['source_code_uri'] = 'https://github.com/Hammer-Lane-Industries/trimble_maps'
|
|
16
|
+
spec.metadata['changelog_uri'] = 'https://github.com/Hammer-Lane-Industries/trimble_maps/blob/master/CHANGELOG.md'
|
|
17
|
+
|
|
18
|
+
# Specify which files should be added to the gem when it is released.
|
|
19
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
|
20
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
|
21
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
|
22
|
+
end
|
|
23
|
+
spec.bindir = 'exe'
|
|
24
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
|
25
|
+
spec.require_paths = ['lib']
|
|
26
|
+
|
|
27
|
+
spec.add_dependency 'httparty', '0.18.1'
|
|
28
|
+
end
|
metadata
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: trimble_maps
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- TheMindlessDevCanada
|
|
8
|
+
autorequire:
|
|
9
|
+
bindir: exe
|
|
10
|
+
cert_chain: []
|
|
11
|
+
date: 2020-08-02 00:00:00.000000000 Z
|
|
12
|
+
dependencies:
|
|
13
|
+
- !ruby/object:Gem::Dependency
|
|
14
|
+
name: httparty
|
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
|
16
|
+
requirements:
|
|
17
|
+
- - '='
|
|
18
|
+
- !ruby/object:Gem::Version
|
|
19
|
+
version: 0.18.1
|
|
20
|
+
type: :runtime
|
|
21
|
+
prerelease: false
|
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
23
|
+
requirements:
|
|
24
|
+
- - '='
|
|
25
|
+
- !ruby/object:Gem::Version
|
|
26
|
+
version: 0.18.1
|
|
27
|
+
description: Unofficial api wrapper for Trimble Maps
|
|
28
|
+
email:
|
|
29
|
+
- swilson@hammer-lane-industries.com
|
|
30
|
+
executables: []
|
|
31
|
+
extensions: []
|
|
32
|
+
extra_rdoc_files: []
|
|
33
|
+
files:
|
|
34
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
|
35
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
|
36
|
+
- ".gitignore"
|
|
37
|
+
- ".idea/.gitignore"
|
|
38
|
+
- ".idea/.rakeTasks"
|
|
39
|
+
- ".idea/dictionaries/shawnwilson.xml"
|
|
40
|
+
- ".idea/misc.xml"
|
|
41
|
+
- ".idea/modules.xml"
|
|
42
|
+
- ".idea/trimble_maps.iml"
|
|
43
|
+
- ".idea/vcs.xml"
|
|
44
|
+
- ".rakeTasks"
|
|
45
|
+
- ".rspec"
|
|
46
|
+
- ".travis.yml"
|
|
47
|
+
- CHANGELOG.md
|
|
48
|
+
- CODE_OF_CONDUCT.md
|
|
49
|
+
- Gemfile
|
|
50
|
+
- Gemfile.lock
|
|
51
|
+
- README.md
|
|
52
|
+
- Rakefile
|
|
53
|
+
- bin/console
|
|
54
|
+
- bin/setup
|
|
55
|
+
- lib/trimble_maps.rb
|
|
56
|
+
- lib/trimble_maps/configuration.rb
|
|
57
|
+
- lib/trimble_maps/location.rb
|
|
58
|
+
- lib/trimble_maps/version.rb
|
|
59
|
+
- trimble_maps.gemspec
|
|
60
|
+
homepage: https://github.com/Hammer-Lane-Industries/trimble_maps
|
|
61
|
+
licenses: []
|
|
62
|
+
metadata:
|
|
63
|
+
homepage_uri: https://github.com/Hammer-Lane-Industries/trimble_maps
|
|
64
|
+
source_code_uri: https://github.com/Hammer-Lane-Industries/trimble_maps
|
|
65
|
+
changelog_uri: https://github.com/Hammer-Lane-Industries/trimble_maps/blob/master/CHANGELOG.md
|
|
66
|
+
post_install_message:
|
|
67
|
+
rdoc_options: []
|
|
68
|
+
require_paths:
|
|
69
|
+
- lib
|
|
70
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
71
|
+
requirements:
|
|
72
|
+
- - ">="
|
|
73
|
+
- !ruby/object:Gem::Version
|
|
74
|
+
version: 2.3.0
|
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
76
|
+
requirements:
|
|
77
|
+
- - ">="
|
|
78
|
+
- !ruby/object:Gem::Version
|
|
79
|
+
version: '0'
|
|
80
|
+
requirements: []
|
|
81
|
+
rubygems_version: 3.1.2
|
|
82
|
+
signing_key:
|
|
83
|
+
specification_version: 4
|
|
84
|
+
summary: Unofficial api wrapper for Trimble Maps
|
|
85
|
+
test_files: []
|