iijmio-cli 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/iijmio/cli.rb +19 -4
- data/lib/iijmio/cli/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: 3a9377b6fe0194bd25784be419e864a127891799
|
4
|
+
data.tar.gz: a408013b018c55c4375e56a76e85e648e4b70c04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cb8d2b1dcdf86308584b885f8dc72373a0b065b0fe9eb34db29d1d34364198bebb9ac674206ab024705618d8c120c1185b7e7b6597c2c938871ababf4eb265e1
|
7
|
+
data.tar.gz: 249df5752d6f115deeb8046594c80a5affb73b67d08954ac5f8100e9b396f3b93eac012561d84dbe656658486cede90a2ebd6486788f376de3900203793aabcc
|
data/lib/iijmio/cli.rb
CHANGED
@@ -138,7 +138,7 @@ module ::Iijmio
|
|
138
138
|
=end
|
139
139
|
desc %{logs}, %{No description.}
|
140
140
|
def logs *args
|
141
|
-
days = args[ 0 ] ||
|
141
|
+
days = args[ 0 ] || 4 # NOTE: 4 days
|
142
142
|
|
143
143
|
response =
|
144
144
|
::Iijmio::CLI.get_iijmio_rest_api(%{/mobile/d/v1/log/packet/})
|
@@ -170,6 +170,8 @@ module ::Iijmio
|
|
170
170
|
+ ID: xxxx
|
171
171
|
- yyyymmdd 0.0 [MB] | 0.0 [MB]
|
172
172
|
=end
|
173
|
+
red_st = "\x1b[31m"
|
174
|
+
red_en = "\x1b[39m"
|
173
175
|
|
174
176
|
puts %{+ SIMs}
|
175
177
|
|
@@ -181,22 +183,35 @@ module ::Iijmio
|
|
181
183
|
|
182
184
|
puts %{ + ID: #{ hdo_service_code }}
|
183
185
|
|
186
|
+
with_coupon_total = 0
|
187
|
+
without_coupon_total = 0
|
188
|
+
|
184
189
|
packet_logs.reverse.each_with_index do | packet_log, index |
|
185
190
|
if index < days.to_i
|
186
191
|
date = packet_log[ %{date} ]
|
187
192
|
with_coupon = packet_log[ %{withCoupon} ]
|
188
193
|
without_coupon = packet_log[ %{withoutCoupon} ]
|
189
194
|
|
195
|
+
with_coupon_total += with_coupon
|
196
|
+
without_coupon_total += without_coupon
|
197
|
+
|
198
|
+
with_coupon_str = %{#{ red_st if with_coupon > 122 }#{ sprintf("%4d", with_coupon) }#{ red_en if with_coupon > 122 } [MB]}
|
199
|
+
with_coupon_total_str = %{#{ red_st if with_coupon_total > 366 }#{ sprintf("%4d", with_coupon_total) }#{ red_en if with_coupon_total > 366 } [MB]}
|
200
|
+
without_coupon_str = %{#{ red_st if without_coupon > 122 }#{ sprintf("%4d", without_coupon) }#{ red_en if without_coupon > 122 } [MB]}
|
201
|
+
without_coupon_total_str = %{#{ red_st if without_coupon_total > 366 }#{ sprintf("%4d", without_coupon_total) }#{ red_en if without_coupon_total > 366 } [MB]}
|
202
|
+
|
190
203
|
logs[ hdd_service_code ][ hdo_service_code ][ date ] = {
|
191
204
|
withCoupon: with_coupon,
|
192
205
|
withoutCoupon: without_coupon
|
193
206
|
}
|
194
207
|
|
195
|
-
puts %{ date | LTE | 200Kbps
|
196
|
-
puts %{
|
197
|
-
puts %{ - #{ date } | #{
|
208
|
+
puts %{ date | LTE | total | 200Kbps | total } if index == 0
|
209
|
+
puts %{ ----------------------------------------------------------} if index == 0
|
210
|
+
puts %{ - #{ date } | #{ with_coupon_str } | #{ with_coupon_total_str } | #{ without_coupon_str } | #{ without_coupon_total_str }}
|
198
211
|
end
|
199
212
|
end
|
213
|
+
|
214
|
+
puts %{}
|
200
215
|
end
|
201
216
|
end
|
202
217
|
|
data/lib/iijmio/cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iijmio-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Takahiro INOUE
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-05-
|
11
|
+
date: 2016-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|