veezo-location-api 0.1.8 → 0.2.2
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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +13 -0
- data/lib/veezo_location_api/client.rb +23 -6
- data/lib/veezo_location_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2cee1cc946a0bdd0095304f91235639b98e604a922fb56a859422fe60d09567e
|
4
|
+
data.tar.gz: 3ab69636e16d77a4e0b14e3c92e8a8f7d11300c50497d07acfbdb57bfd84f8b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdcb6cf085c5037ac555497991b585a53d55d0b13e257a826ef0e9a74ca50d1b8ce9a4450a0598ea8b728ca2f0cbe21cbe9de03ccf14d974f758323c8264b327
|
7
|
+
data.tar.gz: 4a3a857373f060cc1da555e146d072ccf0ea331a6edbfd77e77786eb40331df14103ae8a1b9b0d3d3ffb741d1de43b775612b1b0c6a8e814b46bc5dec7aff913
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -24,6 +24,19 @@ Or install it yourself as:
|
|
24
24
|
|
25
25
|
TODO: Write usage instructions here
|
26
26
|
|
27
|
+
## Publication
|
28
|
+
|
29
|
+
Change version on `/lib/version.rb`
|
30
|
+
|
31
|
+
|
32
|
+
Execute:
|
33
|
+
|
34
|
+
$ gem build veezo_location_api.gemspec
|
35
|
+
|
36
|
+
And execute:
|
37
|
+
|
38
|
+
$ gem push veezo-location-api-0.1.10.gem
|
39
|
+
|
27
40
|
## Development
|
28
41
|
|
29
42
|
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'openssl'
|
3
4
|
require 'net/http'
|
4
5
|
require 'json'
|
5
6
|
require 'veezo_location_api/response'
|
@@ -13,11 +14,26 @@ module VeezoLocationApi
|
|
13
14
|
@tenant_id = tenant_id
|
14
15
|
end
|
15
16
|
|
16
|
-
def
|
17
|
-
|
18
|
-
|
17
|
+
def locations_by_day(occurence: nil)
|
18
|
+
if occurence.nil?
|
19
|
+
occurence = Time.now.utc.strftime("%Y-%m-%d")
|
20
|
+
end
|
21
|
+
|
22
|
+
uri = URI(resolve_uri("/locations/all-by-day?occurence=#{occurence}"))
|
23
|
+
|
24
|
+
get = generate_get(uri)
|
25
|
+
|
26
|
+
request(uri, get)
|
27
|
+
end
|
28
|
+
|
29
|
+
def last_location_by_day(occurence: nil)
|
30
|
+
if occurence.nil?
|
31
|
+
occurence = Time.now.utc.strftime("%Y-%m-%d")
|
32
|
+
end
|
33
|
+
|
34
|
+
uri = URI(resolve_uri("/locations/last-by-day?occurence=#{occurence}"))
|
35
|
+
get = generate_get(uri)
|
19
36
|
|
20
|
-
get = generate_get(uri, body)
|
21
37
|
request(uri, get)
|
22
38
|
end
|
23
39
|
|
@@ -36,7 +52,8 @@ module VeezoLocationApi
|
|
36
52
|
|
37
53
|
def request(uri, request)
|
38
54
|
http_client = Net::HTTP.new(uri.host, uri.port).tap do |client|
|
39
|
-
client.use_ssl = (uri.scheme ==
|
55
|
+
client.use_ssl = (uri.scheme == "https")
|
56
|
+
client.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
40
57
|
end
|
41
58
|
|
42
59
|
response = http_client.request(request)
|
@@ -47,7 +64,7 @@ module VeezoLocationApi
|
|
47
64
|
|
48
65
|
def response(response)
|
49
66
|
code = response.code.to_i
|
50
|
-
success = (code
|
67
|
+
success = (code >= 200 || code < 300)
|
51
68
|
|
52
69
|
if success
|
53
70
|
temp_data = JSON.parse(response.body)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: veezo-location-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Barbiero
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Gsed to expose the methods used for integration with the api.
|
14
14
|
email:
|