ft_42 0.3.3 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ft_42.rb +18 -2
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b89fa0d5eb5e067d88c95d43f4d5bb78d60ae08
4
- data.tar.gz: 9b84aebbc66fadbb76e458b345aae08ff654b195
3
+ metadata.gz: 051de4f40afc1f66babddd02b0ff57edfc089974
4
+ data.tar.gz: c9d8ae2c26a384c2ed40f02fe61d8fd953c39162
5
5
  SHA512:
6
- metadata.gz: c13ca2ee3381905051917308f3c40c7eb352ede19d7672b58c86b5be91a65e8540f75953c9cd5c52e778a437dcd28f671845f45e12655c9b3f44e43ab9f4a98a
7
- data.tar.gz: 316c2f4a531fccdf3199a7aea8d21d0f8f5027f1b7c4a2379d5688ebe12f1ea9455656cdf7d7ff71d1ed5e55010785db145c3748dd5d2e843bab214aa2e25e8b
6
+ metadata.gz: c660b6ebb7179f9e5cfc5c5f6ec84d56ca949025016c4f28ca161047f990862fd6547731ef3f4aac8146ea8440dd96b4ebed58482aee6dd8d18bf02b49c8b30e
7
+ data.tar.gz: '084398ae0a05c678759216d35ebb293752c4cc2700a94c1ea7b2a6879213296eddefbafed1c58927d33338d9dc26a9d436e152ca1893ee659276fe0f33ffdf47'
data/lib/ft_42.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "active_support/all"
2
+ require "date"
2
3
  require "action_view"
3
4
  require "pastel"
4
5
  require "oauth2"
@@ -19,7 +20,14 @@ class FT_42
19
20
  if (args.size > 2)
20
21
  if (args.first == "project")
21
22
  puts "This is a big request, it may take a minute or two."
22
- ft_42 = Client.new(args.second, args.last)
23
+ if (args.include?("after"))
24
+ date = args.pop(3).join(" ")
25
+ date = DateTime.parse(date)
26
+ args.pop
27
+ ft_42 = Client.new(args.second, args.last, date)
28
+ else
29
+ ft_42 = Client.new(args.second, args.last)
30
+ end
23
31
  else
24
32
  ft_42 = Client.new(args.first, args.third)
25
33
  end
@@ -89,7 +97,11 @@ class Client
89
97
  loop do
90
98
  begin
91
99
  tries ||= 3
92
- response = token.get("/v2/projects_users?filter[campus]=#{campus['id']}&filter[project_id]=#{project['id']}", params: { page: i, per_page: 100 }).parsed
100
+ if input_3
101
+ response = token.get("/v2/projects_users?filter[campus]=#{campus['id']}&filter[project_id]=#{project['id']}&range[created_at]=#{after},#{right_now}", params: { page: i, per_page: 100 }).parsed
102
+ else
103
+ response = token.get("/v2/projects_users?filter[campus]=#{campus['id']}&filter[project_id]=#{project['id']}", params: { page: i, per_page: 100 }).parsed
104
+ end
93
105
  rescue
94
106
  puts "Something went wrong..."
95
107
  puts "REFRESHING API TOKEN... wait 8 sec"
@@ -109,6 +121,10 @@ class Client
109
121
 
110
122
  private
111
123
 
124
+ def after
125
+ input_3.to_time.to_s.split(" ")[0...-1].join("T")
126
+ end
127
+
112
128
  def time_ago
113
129
  if input_2
114
130
  time = Time.current - (input_2.to_i * 7).days
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ft_42
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matias Fernandez