fortytwo 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cedb851e9d7327673f703c46e8a0b8f4fe72cbf9
|
4
|
+
data.tar.gz: a33ee8098ee34a42a3c447d5620751cdfd478ba4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6530acae6a01b66bf09b37da422332e2bc029a5be36bfa219170bbd318fbd369a4e5f8dba080edcfcb261556eb1390928a3e75bf6272c042e8ae79f39f3db91b
|
7
|
+
data.tar.gz: e8e652ffaf708f894790b75f4ba61bc669e202310b87211e3798157ae1a23abdd133231a7f7f8343e9ee3d4cb83551afa1f3760d1fe3caa1367081113ab92dd3
|
data/README.md
CHANGED
@@ -34,7 +34,7 @@ This gem uses a client model to query against the API. You need to create and co
|
|
34
34
|
|
35
35
|
### Initialize
|
36
36
|
|
37
|
-
Once you have
|
37
|
+
Once you have your key's you can initialize it like this:
|
38
38
|
|
39
39
|
```ruby
|
40
40
|
require 'fortytwo'
|
@@ -3,20 +3,19 @@ require 'fortytwo/responses/user'
|
|
3
3
|
module FortyTwo
|
4
4
|
module Endpoint
|
5
5
|
class User
|
6
|
-
PATH = '/v2/users'
|
7
6
|
|
8
7
|
def initialize(client)
|
9
8
|
@client = client
|
10
9
|
end
|
11
10
|
|
12
|
-
def user(username, params = {})
|
11
|
+
def user(username, params = { per_page: 100 })
|
13
12
|
Response::User.new(user_request(username, params))
|
14
13
|
end
|
15
14
|
|
16
15
|
private
|
17
16
|
|
18
|
-
def user_request(username, params
|
19
|
-
@client.token.get("
|
17
|
+
def user_request(username, params)
|
18
|
+
@client.token.get("/v2/users/#{username}", params: params).parsed
|
20
19
|
end
|
21
20
|
end
|
22
21
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'fortytwo/responses/user_sessions'
|
2
|
+
|
3
|
+
module FortyTwo
|
4
|
+
module Endpoint
|
5
|
+
class User
|
6
|
+
|
7
|
+
def initialize(client)
|
8
|
+
@client = client
|
9
|
+
end
|
10
|
+
|
11
|
+
def user_sessions(username, start_time = last_monday, end_time = right_now, params = { per_page: 100 })
|
12
|
+
Response::UserSessions.new(user_request(username, start_time, end_time, params))
|
13
|
+
end
|
14
|
+
|
15
|
+
private
|
16
|
+
|
17
|
+
def user_sessions_request(username, start_time, end_time, params)
|
18
|
+
@client.token.get("/v2/users/#{username}/locations?range[begin_at]=#{start_time},#{end_time}", params: params).parsed
|
19
|
+
end
|
20
|
+
|
21
|
+
def last_monday
|
22
|
+
Time.current.beginning_of_week.to_s.split(" ")[0...-1].join("T")
|
23
|
+
end
|
24
|
+
|
25
|
+
def right_now
|
26
|
+
Time.current.to_s.split(" ")[0...-1].join("T")
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'fortytwo/responses/base'
|
2
|
+
require 'fortytwo/responses/models/user_sessions'
|
3
|
+
|
4
|
+
module FortyTwo
|
5
|
+
module Response
|
6
|
+
class UserSessions < Base
|
7
|
+
attr_reader :user_sessions
|
8
|
+
|
9
|
+
def initialize(json)
|
10
|
+
super(json)
|
11
|
+
|
12
|
+
@user_sessions = parse(@user_sessions, Model::UserSession)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
data/lib/fortytwo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortytwo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matias Fernandez
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-11-
|
11
|
+
date: 2016-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- lib/fortytwo/client.rb
|
124
124
|
- lib/fortytwo/configuration.rb
|
125
125
|
- lib/fortytwo/endpoints/user.rb
|
126
|
+
- lib/fortytwo/endpoints/user_sessions.rb
|
126
127
|
- lib/fortytwo/responses/base.rb
|
127
128
|
- lib/fortytwo/responses/models/campus.rb
|
128
129
|
- lib/fortytwo/responses/models/cursus.rb
|
@@ -133,7 +134,9 @@ files:
|
|
133
134
|
- lib/fortytwo/responses/models/project_user.rb
|
134
135
|
- lib/fortytwo/responses/models/skill.rb
|
135
136
|
- lib/fortytwo/responses/models/user.rb
|
137
|
+
- lib/fortytwo/responses/models/user_session.rb
|
136
138
|
- lib/fortytwo/responses/user.rb
|
139
|
+
- lib/fortytwo/responses/user_sessions.rb
|
137
140
|
- lib/fortytwo/version.rb
|
138
141
|
- tasks/console.rake
|
139
142
|
homepage: https://github.com/MatiasFMolinari/fortytwo
|