iijmio-cli 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: dde6cc67d425bf443ace003f1f68854fd2866029
4
- data.tar.gz: ef2d482be99d6fbe84a2821941352f0473ed9778
3
+ metadata.gz: 3a9377b6fe0194bd25784be419e864a127891799
4
+ data.tar.gz: a408013b018c55c4375e56a76e85e648e4b70c04
5
5
  SHA512:
6
- metadata.gz: f02a43e0cad5704b1d6033a94672788a1efca66d287438bc4df9de5400ae2eb7375741bb6d90cf9fe4270e79cc6aeffd26a3958f2a250eb7dd83d9231d8cbab2
7
- data.tar.gz: f5c1ab745a3159cda0898a485bf1b02bb949388b5788bb927144f62e82068115a0fc74180b713ef4e552f4b57fa8ab0dbd53a7f615a06b4efe8fe86d4062e0a6
6
+ metadata.gz: cb8d2b1dcdf86308584b885f8dc72373a0b065b0fe9eb34db29d1d34364198bebb9ac674206ab024705618d8c120c1185b7e7b6597c2c938871ababf4eb265e1
7
+ data.tar.gz: 249df5752d6f115deeb8046594c80a5affb73b67d08954ac5f8100e9b396f3b93eac012561d84dbe656658486cede90a2ebd6486788f376de3900203793aabcc
@@ -138,7 +138,7 @@ module ::Iijmio
138
138
  =end
139
139
  desc %{logs}, %{No description.}
140
140
  def logs *args
141
- days = args[ 0 ] || 3
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 } if index == 0
196
- puts %{ ----------------------------------} if index == 0
197
- puts %{ - #{ date } | #{ sprintf("%4d", with_coupon) } [MB] | #{ sprintf("%4d", without_coupon) } [MB]}
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
 
@@ -1,6 +1,6 @@
1
1
  # -*- coding: utf-8 -*-
2
2
  module ::Iijmio
3
3
  module CLI
4
- VERSION = %{0.0.4}
4
+ VERSION = %{0.0.5}
5
5
  end
6
6
  end
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
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-02 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday