veezo-location-api 0.1.6 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c687c12a3565d22c7bed4aa4b717264173dd569370a161fce89a9ca1f621b5ee
4
- data.tar.gz: 71993057abad2709dd741e9ade80632a101914238feee2f88d36a5af5907e926
3
+ metadata.gz: 5b32af4d5b6e7a8cb685f3c1942ae7290d871247f73ac60f852f4072dad0c279
4
+ data.tar.gz: 2c8c08c8f96946ae64a320cbb3334cc2f35f9f601db91662464ca5a59b8ef92f
5
5
  SHA512:
6
- metadata.gz: 7b1d3d1292b956aeaa9eb976dd4c3f28671ddfcdafad210dd4b4f1025cf01b5aac6622f624759b04c0809c27bcecbfceb33c31dcc390bd89c94c8c72481c50ca
7
- data.tar.gz: d91a1b51a32a7c7a4c972ae6dffb664e7c5fecd1da0751918ae21bf61a3a366c1bd974940d874ba4fd174b04476b34dc19f8b2f0e69bdc020766ec488de0c4c3
6
+ metadata.gz: 1bf5874049265a94c7e626273e5c657e73867b493b0399807319789f19a4a245871b294785cbbcd7af7ab4e8a484934542be994db991e19329e8ab0c43cb9fc7
7
+ data.tar.gz: f262f1975a972cdf09f6dfc8cbc97a8b469d26be154432b1fa8a549a9bd35d46b1930542129fe588dc683ced3f1e564eeb6ee18d51ee00256960bdad3a93dba6
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- veezo-location-api (0.1.6)
4
+ veezo-location-api (0.1.10)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -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,8 +14,24 @@ module VeezoLocationApi
13
14
  @tenant_id = tenant_id
14
15
  end
15
16
 
16
- def locations(occurence: Time.now)
17
- uri = URI(resolve_uri('/locations'))
17
+ def locations_by_day(occurence: nil)
18
+ uri = URI(resolve_uri('/locations/all-by-day'))
19
+ if occurence.nil?
20
+ occurence = Time.now.strftime("%Y-%m-%d")
21
+ end
22
+
23
+ body = { occurence: occurence }
24
+
25
+ get = generate_get(uri, body)
26
+ request(uri, get)
27
+ end
28
+
29
+ def last_locations_by_day(occurence: nil)
30
+ uri = URI(resolve_uri('/locations/last-by-day'))
31
+ if occurence.nil?
32
+ occurence = Time.now.strftime("%Y-%m-%d")
33
+ end
34
+
18
35
  body = { occurence: occurence }
19
36
 
20
37
  get = generate_get(uri, body)
@@ -36,7 +53,8 @@ module VeezoLocationApi
36
53
 
37
54
  def request(uri, request)
38
55
  http_client = Net::HTTP.new(uri.host, uri.port).tap do |client|
39
- client.use_ssl = (uri.scheme == 'https')
56
+ client.use_ssl = (uri.scheme == "https")
57
+ client.verify_mode = OpenSSL::SSL::VERIFY_NONE
40
58
  end
41
59
 
42
60
  response = http_client.request(request)
@@ -47,7 +65,7 @@ module VeezoLocationApi
47
65
 
48
66
  def response(response)
49
67
  code = response.code.to_i
50
- success = (code == 200)
68
+ success = (code >= 200 || code < 300)
51
69
 
52
70
  if success
53
71
  temp_data = JSON.parse(response.body)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VeezoLocationApi
4
- VERSION = '0.1.6'
4
+ VERSION = '0.2.0'
5
5
  end
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.1.6
4
+ version: 0.2.0
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-06-10 00:00:00.000000000 Z
11
+ date: 2020-07-15 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: