ft_42 0.4.0 → 0.4.1
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/ft_42.rb +23 -6
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c634527047f7476d436a1253fd0c4edc2c722b16
|
4
|
+
data.tar.gz: 22c71971b199534fd21dce9a9b00ff7a12dc321c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a7e1ec7c1a340edf2140af8a089f90bceacae00aadf6a25cf3d286bb6e85871c820cd884c27ad7b30fafd5820846e9b381d5f12f22631ed34299f6ed5636748
|
7
|
+
data.tar.gz: b11e520e552f54bc532d1e0bc0add6727748c510fe8662f4ed17e0ba9f37135f77667e6eb3e8ee7f437046f5c921d10630cffcc109e73c322aee94501b660f8a
|
data/lib/ft_42.rb
CHANGED
@@ -21,10 +21,18 @@ class FT_42
|
|
21
21
|
if (args.first == "project")
|
22
22
|
puts "This is a big request, it may take a minute or two."
|
23
23
|
if (args.include?("after"))
|
24
|
-
|
25
|
-
|
24
|
+
after = args.pop(3).join(" ")
|
25
|
+
after = DateTime.parse(after)
|
26
26
|
args.pop
|
27
|
-
ft_42 = Client.new(args.second, args.last,
|
27
|
+
ft_42 = Client.new(args.second, args.last, after)
|
28
|
+
elsif (args.include?("between"))
|
29
|
+
before = args.pop(3).join(" ")
|
30
|
+
before = DateTime.parse(before)
|
31
|
+
args.pop
|
32
|
+
after = args.pop(3).join(" ")
|
33
|
+
after = DateTime.parse(after)
|
34
|
+
args.pop
|
35
|
+
ft_42 = Client.new(args.second, args.last, after, before)
|
28
36
|
else
|
29
37
|
ft_42 = Client.new(args.second, args.last)
|
30
38
|
end
|
@@ -66,12 +74,13 @@ end
|
|
66
74
|
|
67
75
|
|
68
76
|
class Client
|
69
|
-
attr_reader :input_1, :input_2, :input_3, :token
|
77
|
+
attr_reader :input_1, :input_2, :input_3, :input_4, :token
|
70
78
|
|
71
|
-
def initialize(input_1, input_2 = nil, input_3 = nil)
|
79
|
+
def initialize(input_1, input_2 = nil, input_3 = nil, input_4 = nil)
|
72
80
|
@input_1 = input_1
|
73
81
|
@input_2 = input_2
|
74
82
|
@input_3 = input_3
|
83
|
+
@input_4 = input_4
|
75
84
|
@token = Token.new.token
|
76
85
|
end
|
77
86
|
|
@@ -98,7 +107,7 @@ class Client
|
|
98
107
|
begin
|
99
108
|
tries ||= 3
|
100
109
|
if input_3
|
101
|
-
response = token.get("/v2/projects_users?filter[campus]=#{campus['id']}&filter[project_id]=#{project['id']}&range[created_at]=#{after},#{
|
110
|
+
response = token.get("/v2/projects_users?filter[campus]=#{campus['id']}&filter[project_id]=#{project['id']}&range[created_at]=#{after},#{before}", params: { page: i, per_page: 100 }).parsed
|
102
111
|
else
|
103
112
|
response = token.get("/v2/projects_users?filter[campus]=#{campus['id']}&filter[project_id]=#{project['id']}", params: { page: i, per_page: 100 }).parsed
|
104
113
|
end
|
@@ -125,6 +134,14 @@ class Client
|
|
125
134
|
input_3.to_time.to_s.split(" ")[0...-1].join("T")
|
126
135
|
end
|
127
136
|
|
137
|
+
def before
|
138
|
+
if input_4
|
139
|
+
input_4.to_time.to_s.split(" ")[0...-1].join("T")
|
140
|
+
else
|
141
|
+
Time.current.beginning_of_week.to_s.split(" ")[0...-1].join("T")
|
142
|
+
end
|
143
|
+
end
|
144
|
+
|
128
145
|
def time_ago
|
129
146
|
if input_2
|
130
147
|
time = Time.current - (input_2.to_i * 7).days
|