usabilla_api 1.1.1 → 1.1.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/lib/usabilla_api/usabilla_api.rb +15 -3
- data/lib/usabilla_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5b66214b5c6c7b4487f79a3cc60e5e7d5f586aa5
|
4
|
+
data.tar.gz: 3877f1cc54cc0ff5d6c26b89f83eaae54adbdc84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54d8d0c1dfbb4536f785c47fc44b117bde9290202ab0b4a5c70343b70c38f916afe3cdc739e44fb7f601993ce4a4e215adfbdf1cd25a1fc066d558311d45cd6b
|
7
|
+
data.tar.gz: b03657d1f988807d8d1dfc22f98d09253dc57db71bed5e1c67bae03b220f80188f9358de64df3ac217b2c6a8e73d81d5620bc5a0544270b1a82125d07261c68a
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'rest-client'
|
2
2
|
require 'openssl'
|
3
3
|
require 'json'
|
4
|
+
require 'date'
|
4
5
|
|
5
6
|
module UsabillaApi
|
6
7
|
|
@@ -14,8 +15,10 @@ module UsabillaApi
|
|
14
15
|
@base_scope = UsabillaApi.configuration.base_scope
|
15
16
|
@access_key = UsabillaApi.configuration.access_key
|
16
17
|
@secret_key = UsabillaApi.configuration.secret_key
|
17
|
-
@
|
18
|
-
@
|
18
|
+
@query_id = params['id'] || String.new
|
19
|
+
@query_limit = params['limit'] || String.new
|
20
|
+
@query_since = params['since'] || String.new
|
21
|
+
@query_days_ago = params['days_ago'] || nil
|
19
22
|
end
|
20
23
|
|
21
24
|
def get_buttons
|
@@ -56,7 +59,7 @@ module UsabillaApi
|
|
56
59
|
datestamp = t.strftime('%Y%m%d') # Date w/o time, used in credential scope
|
57
60
|
long_date = t.strftime('%Y%m%dT%H%M%SZ')
|
58
61
|
|
59
|
-
query_string = "limit=#{@
|
62
|
+
query_string = "limit=#{@query_limit}&since=#{get_since_timestamp}"
|
60
63
|
canonical_headers = "date:#{usbldate}\nhost:#{@host}\n"
|
61
64
|
signed_headers = 'date;host'
|
62
65
|
payload_hash = OpenSSL::Digest::SHA256.new.hexdigest
|
@@ -94,5 +97,14 @@ module UsabillaApi
|
|
94
97
|
uri.gsub(':id', @query_id)
|
95
98
|
end
|
96
99
|
|
100
|
+
def since_filter(amount)
|
101
|
+
date_now = DateTime.now.new_offset(0)
|
102
|
+
date_ago = date_now - amount.to_i
|
103
|
+
(date_ago.to_time.to_f * 1000).to_i
|
104
|
+
end
|
105
|
+
|
106
|
+
def get_since_timestamp
|
107
|
+
@query_days_ago ? since_filter(@query_days_ago) : @query_since
|
108
|
+
end
|
97
109
|
end
|
98
110
|
end
|
data/lib/usabilla_api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usabilla_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Molinaro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-05-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|