huawei_e5180_api 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +19 -0
- data/Gemfile.lock +253 -0
- data/Guardfile +41 -0
- data/LICENSE +22 -0
- data/README.md +21 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/huawei_e5180_monitoring.gemspec +100 -0
- data/lib/huawei_e5180_api.rb +62 -0
- data/spec/fixtures/cassettes/check_notifications.yml +508 -0
- data/spec/fixtures/cassettes/converged_status.yml +508 -0
- data/spec/fixtures/cassettes/current_plmn.yml +504 -0
- data/spec/fixtures/cassettes/mobile_dataswitch.yml +504 -0
- data/spec/fixtures/cassettes/status.yml +508 -0
- data/spec/fixtures/cassettes/status_info.yml +504 -0
- data/spec/fixtures/cassettes/traffic_statistics.yml +520 -0
- data/spec/huawei_e5180_api_spec.rb +129 -0
- data/spec/spec_helper.rb +18 -0
- data/spec/support/vcr.rb +9 -0
- metadata +262 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e4215859c440d47cf90917f56acead9b64660fe5
|
4
|
+
data.tar.gz: 1f74aa55ec717c67d496f23cde05a27aca5d9c56
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 4bc0406fd69a193283572c880db5d3880592c3d6b5df6393b7d20776014197d13149e9fa444c3957c8022579a0794fc00449016d3cb4ad8ff5062fbe7bfb93cc
|
7
|
+
data.tar.gz: b7482d5dad80d6606233d3c2a9f65ea9c3604e25595af1052e53cce357ad2a6d47c998dcd014144446154d0860bc6935476d8b1d5a326fe47a465efb997e22bc
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/Gemfile
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
gem 'mechanize'
|
4
|
+
gem 'activesupport'
|
5
|
+
|
6
|
+
group :development do
|
7
|
+
gem 'rspec'
|
8
|
+
gem 'vcr'
|
9
|
+
gem 'webmock'
|
10
|
+
gem 'guard-bundler', require: false
|
11
|
+
gem 'guard-rspec', require: false
|
12
|
+
gem 'guard-rubocop'
|
13
|
+
gem 'guard-cane', git: 'https://github.com/guard/guard-cane.git'
|
14
|
+
gem 'guard-rubycritic'
|
15
|
+
gem 'rdoc', '~> 3.12'
|
16
|
+
gem 'bundler', '~> 1.0'
|
17
|
+
gem 'jeweler', '~> 2.0.1'
|
18
|
+
gem 'simplecov', '>= 0'
|
19
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,253 @@
|
|
1
|
+
GIT
|
2
|
+
remote: https://github.com/guard/guard-cane.git
|
3
|
+
revision: be2c7ba8c6d62c300c65eeb06ea26ebd0610bdba
|
4
|
+
specs:
|
5
|
+
guard-cane (0.2.1)
|
6
|
+
cane
|
7
|
+
guard (>= 2.10.0)
|
8
|
+
guard-compat (~> 1.1)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: http://rubygems.org/
|
12
|
+
specs:
|
13
|
+
abstract_type (0.0.7)
|
14
|
+
activesupport (4.2.1)
|
15
|
+
i18n (~> 0.7)
|
16
|
+
json (~> 1.7, >= 1.7.7)
|
17
|
+
minitest (~> 5.1)
|
18
|
+
thread_safe (~> 0.3, >= 0.3.4)
|
19
|
+
tzinfo (~> 1.1)
|
20
|
+
adamantium (0.2.0)
|
21
|
+
ice_nine (~> 0.11.0)
|
22
|
+
memoizable (~> 0.4.0)
|
23
|
+
addressable (2.3.8)
|
24
|
+
ast (2.0.0)
|
25
|
+
astrolabe (1.3.0)
|
26
|
+
parser (>= 2.2.0.pre.3, < 3.0)
|
27
|
+
axiom-types (0.1.1)
|
28
|
+
descendants_tracker (~> 0.0.4)
|
29
|
+
ice_nine (~> 0.11.0)
|
30
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
31
|
+
builder (3.2.2)
|
32
|
+
cane (2.6.2)
|
33
|
+
parallel
|
34
|
+
celluloid (0.16.0)
|
35
|
+
timers (~> 4.0.0)
|
36
|
+
coderay (1.1.0)
|
37
|
+
coercible (1.0.0)
|
38
|
+
descendants_tracker (~> 0.0.1)
|
39
|
+
concord (0.1.5)
|
40
|
+
adamantium (~> 0.2.0)
|
41
|
+
equalizer (~> 0.0.9)
|
42
|
+
crack (0.4.2)
|
43
|
+
safe_yaml (~> 1.0.0)
|
44
|
+
descendants_tracker (0.0.4)
|
45
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
46
|
+
diff-lcs (1.2.5)
|
47
|
+
docile (1.1.5)
|
48
|
+
domain_name (0.5.24)
|
49
|
+
unf (>= 0.0.5, < 1.0.0)
|
50
|
+
equalizer (0.0.11)
|
51
|
+
faraday (0.9.1)
|
52
|
+
multipart-post (>= 1.2, < 3)
|
53
|
+
ffi (1.9.8)
|
54
|
+
flay (2.4.0)
|
55
|
+
ruby_parser (~> 3.0)
|
56
|
+
sexp_processor (~> 4.0)
|
57
|
+
flog (4.2.1)
|
58
|
+
ruby_parser (~> 3.1, > 3.1.0)
|
59
|
+
sexp_processor (~> 4.4)
|
60
|
+
formatador (0.2.5)
|
61
|
+
git (1.2.9.1)
|
62
|
+
github_api (0.12.3)
|
63
|
+
addressable (~> 2.3)
|
64
|
+
descendants_tracker (~> 0.0.4)
|
65
|
+
faraday (~> 0.8, < 0.10)
|
66
|
+
hashie (>= 3.3)
|
67
|
+
multi_json (>= 1.7.5, < 2.0)
|
68
|
+
nokogiri (~> 1.6.3)
|
69
|
+
oauth2
|
70
|
+
guard (2.12.5)
|
71
|
+
formatador (>= 0.2.4)
|
72
|
+
listen (~> 2.7)
|
73
|
+
lumberjack (~> 1.0)
|
74
|
+
nenv (~> 0.1)
|
75
|
+
notiffany (~> 0.0)
|
76
|
+
pry (>= 0.9.12)
|
77
|
+
shellany (~> 0.0)
|
78
|
+
thor (>= 0.18.1)
|
79
|
+
guard-bundler (2.1.0)
|
80
|
+
bundler (~> 1.0)
|
81
|
+
guard (~> 2.2)
|
82
|
+
guard-compat (~> 1.1)
|
83
|
+
guard-compat (1.2.1)
|
84
|
+
guard-rspec (4.5.0)
|
85
|
+
guard (~> 2.1)
|
86
|
+
guard-compat (~> 1.1)
|
87
|
+
rspec (>= 2.99.0, < 4.0)
|
88
|
+
guard-rubocop (1.2.0)
|
89
|
+
guard (~> 2.0)
|
90
|
+
rubocop (~> 0.20)
|
91
|
+
guard-rubycritic (1.4.0)
|
92
|
+
guard (~> 2.6)
|
93
|
+
rubycritic (~> 1.4)
|
94
|
+
hashie (3.4.1)
|
95
|
+
highline (1.7.2)
|
96
|
+
hitimes (1.2.2)
|
97
|
+
http-cookie (1.0.2)
|
98
|
+
domain_name (~> 0.5)
|
99
|
+
i18n (0.7.0)
|
100
|
+
ice_nine (0.11.1)
|
101
|
+
jeweler (2.0.1)
|
102
|
+
builder
|
103
|
+
bundler (>= 1.0)
|
104
|
+
git (>= 1.2.5)
|
105
|
+
github_api
|
106
|
+
highline (>= 1.6.15)
|
107
|
+
nokogiri (>= 1.5.10)
|
108
|
+
rake
|
109
|
+
rdoc
|
110
|
+
json (1.8.2)
|
111
|
+
jwt (1.4.1)
|
112
|
+
listen (2.10.0)
|
113
|
+
celluloid (~> 0.16.0)
|
114
|
+
rb-fsevent (>= 0.9.3)
|
115
|
+
rb-inotify (>= 0.9)
|
116
|
+
lumberjack (1.0.9)
|
117
|
+
mechanize (2.7.3)
|
118
|
+
domain_name (~> 0.5, >= 0.5.1)
|
119
|
+
http-cookie (~> 1.0)
|
120
|
+
mime-types (~> 2.0)
|
121
|
+
net-http-digest_auth (~> 1.1, >= 1.1.1)
|
122
|
+
net-http-persistent (~> 2.5, >= 2.5.2)
|
123
|
+
nokogiri (~> 1.4)
|
124
|
+
ntlm-http (~> 0.1, >= 0.1.1)
|
125
|
+
webrobots (>= 0.0.9, < 0.2)
|
126
|
+
memoizable (0.4.2)
|
127
|
+
thread_safe (~> 0.3, >= 0.3.1)
|
128
|
+
method_source (0.8.2)
|
129
|
+
mime-types (2.5)
|
130
|
+
mini_portile (0.6.2)
|
131
|
+
minitest (5.6.1)
|
132
|
+
multi_json (1.11.0)
|
133
|
+
multi_xml (0.5.5)
|
134
|
+
multipart-post (2.0.0)
|
135
|
+
nenv (0.2.0)
|
136
|
+
net-http-digest_auth (1.4)
|
137
|
+
net-http-persistent (2.9.4)
|
138
|
+
nokogiri (1.6.6.2)
|
139
|
+
mini_portile (~> 0.6.0)
|
140
|
+
notiffany (0.0.6)
|
141
|
+
nenv (~> 0.1)
|
142
|
+
shellany (~> 0.0)
|
143
|
+
ntlm-http (0.1.1)
|
144
|
+
oauth2 (1.0.0)
|
145
|
+
faraday (>= 0.8, < 0.10)
|
146
|
+
jwt (~> 1.0)
|
147
|
+
multi_json (~> 1.3)
|
148
|
+
multi_xml (~> 0.5)
|
149
|
+
rack (~> 1.2)
|
150
|
+
parallel (1.4.1)
|
151
|
+
parser (2.2.2.2)
|
152
|
+
ast (>= 1.1, < 3.0)
|
153
|
+
powerpack (0.1.0)
|
154
|
+
procto (0.0.2)
|
155
|
+
pry (0.10.1)
|
156
|
+
coderay (~> 1.1.0)
|
157
|
+
method_source (~> 0.8.1)
|
158
|
+
slop (~> 3.4)
|
159
|
+
rack (1.6.0)
|
160
|
+
rainbow (2.0.0)
|
161
|
+
rake (10.4.2)
|
162
|
+
rb-fsevent (0.9.4)
|
163
|
+
rb-inotify (0.9.5)
|
164
|
+
ffi (>= 0.5.0)
|
165
|
+
rdoc (3.12.2)
|
166
|
+
json (~> 1.4)
|
167
|
+
reek (1.6.5)
|
168
|
+
parser (~> 2.2.0.pre.7)
|
169
|
+
rainbow (>= 1.99, < 3.0)
|
170
|
+
unparser (~> 0.2.2)
|
171
|
+
rspec (3.2.0)
|
172
|
+
rspec-core (~> 3.2.0)
|
173
|
+
rspec-expectations (~> 3.2.0)
|
174
|
+
rspec-mocks (~> 3.2.0)
|
175
|
+
rspec-core (3.2.3)
|
176
|
+
rspec-support (~> 3.2.0)
|
177
|
+
rspec-expectations (3.2.1)
|
178
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
179
|
+
rspec-support (~> 3.2.0)
|
180
|
+
rspec-mocks (3.2.1)
|
181
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
182
|
+
rspec-support (~> 3.2.0)
|
183
|
+
rspec-support (3.2.2)
|
184
|
+
rubocop (0.30.1)
|
185
|
+
astrolabe (~> 1.3)
|
186
|
+
parser (>= 2.2.2.1, < 3.0)
|
187
|
+
powerpack (~> 0.1)
|
188
|
+
rainbow (>= 1.99.1, < 3.0)
|
189
|
+
ruby-progressbar (~> 1.4)
|
190
|
+
ruby-progressbar (1.7.5)
|
191
|
+
ruby_parser (3.6.6)
|
192
|
+
sexp_processor (~> 4.1)
|
193
|
+
rubycritic (1.4.0)
|
194
|
+
flay (= 2.4.0)
|
195
|
+
flog (= 4.2.1)
|
196
|
+
parser (>= 2.2.0, < 3.0)
|
197
|
+
reek (= 1.6.5)
|
198
|
+
virtus (~> 1.0)
|
199
|
+
safe_yaml (1.0.4)
|
200
|
+
sexp_processor (4.5.1)
|
201
|
+
shellany (0.0.1)
|
202
|
+
simplecov (0.10.0)
|
203
|
+
docile (~> 1.1.0)
|
204
|
+
json (~> 1.8)
|
205
|
+
simplecov-html (~> 0.10.0)
|
206
|
+
simplecov-html (0.10.0)
|
207
|
+
slop (3.6.0)
|
208
|
+
thor (0.19.1)
|
209
|
+
thread_safe (0.3.5)
|
210
|
+
timers (4.0.1)
|
211
|
+
hitimes
|
212
|
+
tzinfo (1.2.2)
|
213
|
+
thread_safe (~> 0.1)
|
214
|
+
unf (0.1.4)
|
215
|
+
unf_ext
|
216
|
+
unf_ext (0.0.7.1)
|
217
|
+
unparser (0.2.3)
|
218
|
+
abstract_type (~> 0.0.7)
|
219
|
+
adamantium (~> 0.2.0)
|
220
|
+
concord (~> 0.1.5)
|
221
|
+
diff-lcs (~> 1.2.5)
|
222
|
+
equalizer (~> 0.0.9)
|
223
|
+
parser (~> 2.2.2, >= 2.2.2.2)
|
224
|
+
procto (~> 0.0.2)
|
225
|
+
vcr (2.9.3)
|
226
|
+
virtus (1.0.5)
|
227
|
+
axiom-types (~> 0.1)
|
228
|
+
coercible (~> 1.0)
|
229
|
+
descendants_tracker (~> 0.0, >= 0.0.3)
|
230
|
+
equalizer (~> 0.0, >= 0.0.9)
|
231
|
+
webmock (1.20.4)
|
232
|
+
addressable (>= 2.3.6)
|
233
|
+
crack (>= 0.3.2)
|
234
|
+
webrobots (0.1.1)
|
235
|
+
|
236
|
+
PLATFORMS
|
237
|
+
ruby
|
238
|
+
|
239
|
+
DEPENDENCIES
|
240
|
+
activesupport
|
241
|
+
bundler (~> 1.0)
|
242
|
+
guard-bundler
|
243
|
+
guard-cane!
|
244
|
+
guard-rspec
|
245
|
+
guard-rubocop
|
246
|
+
guard-rubycritic
|
247
|
+
jeweler (~> 2.0.1)
|
248
|
+
mechanize
|
249
|
+
rdoc (~> 3.12)
|
250
|
+
rspec
|
251
|
+
simplecov
|
252
|
+
vcr
|
253
|
+
webmock
|
data/Guardfile
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
guard :bundler do
|
2
|
+
require 'guard/bundler'
|
3
|
+
require 'guard/bundler/verify'
|
4
|
+
helper = Guard::Bundler::Verify.new
|
5
|
+
|
6
|
+
files = ['Gemfile']
|
7
|
+
files += Dir['*.gemspec'] if files.any? { |f| helper.uses_gemspec?(f) }
|
8
|
+
|
9
|
+
# Assume files are symlinked from somewhere
|
10
|
+
files.each { |file| watch(helper.real_path(file)) }
|
11
|
+
end
|
12
|
+
|
13
|
+
guard :cane, run_on_start: true do
|
14
|
+
watch(/^(.+)\.rb$/)
|
15
|
+
end
|
16
|
+
|
17
|
+
guard :rubocop, cli: ['--auto-correct'], run_on_start: true do
|
18
|
+
watch(/.+\.rb$/)
|
19
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
20
|
+
end
|
21
|
+
|
22
|
+
guard :rubycritic, run_on_start: true do
|
23
|
+
watch(%r{^lib/(.+)\.rb$})
|
24
|
+
end
|
25
|
+
|
26
|
+
guard :rspec, all_on_start: true, cmd: 'bundle exec rspec' do
|
27
|
+
require 'guard/rspec/dsl'
|
28
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
29
|
+
|
30
|
+
rspec = dsl.rspec
|
31
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
32
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
33
|
+
watch(rspec.spec_files)
|
34
|
+
|
35
|
+
ruby = dsl.ruby
|
36
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
37
|
+
|
38
|
+
watch('lib/huawei_e5180_api.rb') do
|
39
|
+
'spec/huawei_e5180_api_spec.rb'
|
40
|
+
end
|
41
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2015 Marcin Nowicki
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# huawei_e5180_api
|
2
|
+
|
3
|
+
Api support for Huawei E5180 LTE modem in ruby.
|
4
|
+
|
5
|
+
## Why?
|
6
|
+
|
7
|
+
As mobile companies give shitty data cap of 100GB on "unlimited" plans (after which you land with 2M/384k connection) we want to know internet usage distribution.
|
8
|
+
|
9
|
+
## Contributing to huawei_e5180_api
|
10
|
+
|
11
|
+
* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
|
12
|
+
* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
|
13
|
+
* Fork the project.
|
14
|
+
* Start a feature/bugfix branch.
|
15
|
+
* Commit and push until you are happy with your contribution.
|
16
|
+
* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
|
17
|
+
* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
18
|
+
|
19
|
+
## License
|
20
|
+
|
21
|
+
MIT. Copyright (c) 2015 Marcin Nowicki. See LICENSE for further details.
|
data/Rakefile
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'bundler'
|
5
|
+
begin
|
6
|
+
Bundler.setup(:default, :development)
|
7
|
+
rescue Bundler::BundlerError => e
|
8
|
+
$stderr.puts e.message
|
9
|
+
$stderr.puts 'Run `bundle install` to install missing gems'
|
10
|
+
exit e.status_code
|
11
|
+
end
|
12
|
+
require 'rake'
|
13
|
+
|
14
|
+
require 'jeweler'
|
15
|
+
Jeweler::Tasks.new do |gem|
|
16
|
+
# gem is a Gem::Specification...
|
17
|
+
# see http://guides.rubygems.org/specification-reference/ for more options
|
18
|
+
gem.name = 'huawei_e5180_api'
|
19
|
+
gem.homepage = 'http://github.com/pr0d1r2/huawei_e5180_api'
|
20
|
+
gem.license = 'MIT'
|
21
|
+
gem.summary = %(Api support for Huawei E5180 LTE modem in ruby.)
|
22
|
+
gem.description = %(Api support for Huawei E5180 LTE modem in ruby.)
|
23
|
+
gem.email = 'pr0d1r2@gmail.com'
|
24
|
+
gem.authors = ['Marcin Nowicki']
|
25
|
+
# dependencies defined in Gemfile
|
26
|
+
end
|
27
|
+
Jeweler::RubygemsDotOrgTasks.new
|
28
|
+
|
29
|
+
require 'rspec/core'
|
30
|
+
require 'rspec/core/rake_task'
|
31
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
32
|
+
spec.pattern = FileList['spec/**/*_spec.rb']
|
33
|
+
end
|
34
|
+
|
35
|
+
desc 'Code coverage detail'
|
36
|
+
task :simplecov do
|
37
|
+
ENV['COVERAGE'] = 'true'
|
38
|
+
Rake::Task['spec'].execute
|
39
|
+
end
|
40
|
+
|
41
|
+
task default: :spec
|
42
|
+
|
43
|
+
require 'rdoc/task'
|
44
|
+
Rake::RDocTask.new do |rdoc|
|
45
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ''
|
46
|
+
|
47
|
+
rdoc.rdoc_dir = 'rdoc'
|
48
|
+
rdoc.title = "huawei_e5180_monitoring #{version}"
|
49
|
+
rdoc.rdoc_files.include('README*')
|
50
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
51
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,100 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: huawei_e5180_monitoring 0.1.0 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "huawei_e5180_monitoring"
|
9
|
+
s.version = "0.1.0"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib"]
|
13
|
+
s.authors = ["Marcin Nowicki"]
|
14
|
+
s.date = "2015-04-30"
|
15
|
+
s.description = "TODO: longer description of your gem"
|
16
|
+
s.email = "pr0d1r2@gmail.com"
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"LICENSE",
|
19
|
+
"README.md"
|
20
|
+
]
|
21
|
+
s.files = [
|
22
|
+
".document",
|
23
|
+
".rspec",
|
24
|
+
"Gemfile",
|
25
|
+
"Gemfile.lock",
|
26
|
+
"Guardfile",
|
27
|
+
"LICENSE",
|
28
|
+
"README.md",
|
29
|
+
"Rakefile",
|
30
|
+
"VERSION",
|
31
|
+
"huawei_e5180_monitoring.gemspec",
|
32
|
+
"lib/huawei_e5180_api.rb",
|
33
|
+
"spec/fixtures/cassettes/check_notifications.yml",
|
34
|
+
"spec/fixtures/cassettes/converged_status.yml",
|
35
|
+
"spec/fixtures/cassettes/current_plmn.yml",
|
36
|
+
"spec/fixtures/cassettes/mobile_dataswitch.yml",
|
37
|
+
"spec/fixtures/cassettes/status.yml",
|
38
|
+
"spec/fixtures/cassettes/status_info.yml",
|
39
|
+
"spec/fixtures/cassettes/traffic_statistics.yml",
|
40
|
+
"spec/huawei_e5180_api_spec.rb",
|
41
|
+
"spec/spec_helper.rb",
|
42
|
+
"spec/support/vcr.rb"
|
43
|
+
]
|
44
|
+
s.homepage = "http://github.com/pr0d1r2/huawei_e5180_monitoring"
|
45
|
+
s.licenses = ["MIT"]
|
46
|
+
s.rubygems_version = "2.4.5"
|
47
|
+
s.summary = "TODO: one-line summary of your gem"
|
48
|
+
|
49
|
+
if s.respond_to? :specification_version then
|
50
|
+
s.specification_version = 4
|
51
|
+
|
52
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
53
|
+
s.add_runtime_dependency(%q<mechanize>, [">= 0"])
|
54
|
+
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
55
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
56
|
+
s.add_development_dependency(%q<vcr>, [">= 0"])
|
57
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
58
|
+
s.add_development_dependency(%q<guard-bundler>, [">= 0"])
|
59
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
60
|
+
s.add_development_dependency(%q<guard-rubocop>, [">= 0"])
|
61
|
+
s.add_development_dependency(%q<guard-cane>, [">= 0"])
|
62
|
+
s.add_development_dependency(%q<guard-rubycritic>, [">= 0"])
|
63
|
+
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
64
|
+
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
65
|
+
s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
|
66
|
+
s.add_development_dependency(%q<simplecov>, [">= 0"])
|
67
|
+
else
|
68
|
+
s.add_dependency(%q<mechanize>, [">= 0"])
|
69
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
70
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
71
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
72
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
73
|
+
s.add_dependency(%q<guard-bundler>, [">= 0"])
|
74
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
75
|
+
s.add_dependency(%q<guard-rubocop>, [">= 0"])
|
76
|
+
s.add_dependency(%q<guard-cane>, [">= 0"])
|
77
|
+
s.add_dependency(%q<guard-rubycritic>, [">= 0"])
|
78
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
79
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
80
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
81
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
82
|
+
end
|
83
|
+
else
|
84
|
+
s.add_dependency(%q<mechanize>, [">= 0"])
|
85
|
+
s.add_dependency(%q<activesupport>, [">= 0"])
|
86
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
87
|
+
s.add_dependency(%q<vcr>, [">= 0"])
|
88
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
89
|
+
s.add_dependency(%q<guard-bundler>, [">= 0"])
|
90
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
91
|
+
s.add_dependency(%q<guard-rubocop>, [">= 0"])
|
92
|
+
s.add_dependency(%q<guard-cane>, [">= 0"])
|
93
|
+
s.add_dependency(%q<guard-rubycritic>, [">= 0"])
|
94
|
+
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
95
|
+
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
96
|
+
s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
|
97
|
+
s.add_dependency(%q<simplecov>, [">= 0"])
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
require 'mechanize'
|
2
|
+
require 'active_support'
|
3
|
+
require 'active_support/core_ext'
|
4
|
+
|
5
|
+
# monitor Huawei E5180 LTE modem
|
6
|
+
class HuaweiE5180Api < Mechanize
|
7
|
+
attr_accessor :address
|
8
|
+
|
9
|
+
DEFAULT_ADDRESS = '192.168.8.1'
|
10
|
+
|
11
|
+
def initialize(address = DEFAULT_ADDRESS)
|
12
|
+
@address = address
|
13
|
+
super
|
14
|
+
cookie!
|
15
|
+
end
|
16
|
+
|
17
|
+
def method_missing(m, *_args, &_block)
|
18
|
+
Hash.from_xml(get(send("#{m}_url")).body)['response']
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def monitoring_url(endpoint)
|
24
|
+
"http://#{address}/api/monitoring/#{endpoint}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def status_url
|
28
|
+
monitoring_url('status')
|
29
|
+
end
|
30
|
+
|
31
|
+
def status_info_url
|
32
|
+
"http://#{address}/api/cradle/status-info"
|
33
|
+
end
|
34
|
+
|
35
|
+
def check_notifications_url
|
36
|
+
monitoring_url('check-notifications')
|
37
|
+
end
|
38
|
+
|
39
|
+
def mobile_dataswitch_url
|
40
|
+
"http://#{address}/api/dialup/mobile-dataswitch"
|
41
|
+
end
|
42
|
+
|
43
|
+
def traffic_statistics_url
|
44
|
+
monitoring_url('traffic-statistics')
|
45
|
+
end
|
46
|
+
|
47
|
+
def converged_status_url
|
48
|
+
monitoring_url('converged-status')
|
49
|
+
end
|
50
|
+
|
51
|
+
def current_plmn_url
|
52
|
+
"http://#{address}/api/net/current-plmn"
|
53
|
+
end
|
54
|
+
|
55
|
+
def home_url
|
56
|
+
"http://#{address}/html/home.html"
|
57
|
+
end
|
58
|
+
|
59
|
+
def cookie!
|
60
|
+
@cookie_request ||= get(home_url)
|
61
|
+
end
|
62
|
+
end
|