enfcli 3.9.1 → 3.9.2.pre.alpha

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
  SHA256:
3
- metadata.gz: 1c6a382798136027c0585cb4ad35d61fe7ca066f8ea21d74588986c91d7f8de4
4
- data.tar.gz: 5dde4092d3af7d9d33e237d196ce46281cc93f5e1b5c706a2ae631d3cb27ee0b
3
+ metadata.gz: 3e33b30f23aa6e35646e29495d0de25b8fd7982ff96627fafa8e656eadca30d6
4
+ data.tar.gz: ce55885a00376eaac113e3e6e552a81b19de8df5f691acdbbfd8aa1e59f1580d
5
5
  SHA512:
6
- metadata.gz: 01d9e52857a76e8f00d6b5075443fb2d7e727464bf3c8aead47f0921e30f262c2af7b8b1f4f5ec4f03db795289b83edf45b5ec4658cb07688b8b77ebd4c18485
7
- data.tar.gz: 25dd17b213d54b5afaab8ece81fce9d4a8a65db46767f08cccaff880bd55ae1012a3e62e21dd74edbfe703b14dded2b805b68521ea46f48cac6d31ed0aa93964
6
+ metadata.gz: 8439c0f1422f4af9966cd7b773aeb8d8e9da9da2afd863929dde665c0903b0d9f1dc55c409b58a36e2dcbf5ab204af9c2798f70a2f7cf501fd23eb33ac0a0878
7
+ data.tar.gz: c4b9bc36805008505d8e1e13f11bbbaf9a64985612a5214b26346beaba852ba5b30c5c569a14b37c4cef79e3cce62a0ec6aee42939d2e9ba0148320854b7096b
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enfcli (3.9.1)
4
+ enfcli (3.9.2.pre.alpha)
5
5
  rest-client (~> 2.0)
6
6
  terminal-table
7
7
  thor (~> 0.20.0)
data/lib/enfapi.rb CHANGED
@@ -226,18 +226,17 @@ module EnfApi
226
226
  EnfApi::API.instance.put "/api/captive/v1/wifi/#{wifi_id}", json
227
227
  end
228
228
 
229
-
230
229
  # Post the new device
231
230
  ## NO_TEST
232
231
  def create_device(new_dev_hash)
233
- json = EnfApi.to_json(new_dev_hash)
234
- EnfApi::API.instance.post "/api/captive/v1/device", json
232
+ json = EnfApi.to_json(new_dev_hash)
233
+ EnfApi::API.instance.post '/api/captive/v1/device', json
235
234
  end
236
235
 
237
236
  # Get the list of devices
238
237
  ## NO_TEST
239
238
  def list_devices(network)
240
- url = "/api/captive/v1/device"
239
+ url = '/api/captive/v1/device'
241
240
  url = "#{url}?#{network}" if network
242
241
  EnfApi::API.instance.get url
243
242
  end
@@ -19,7 +19,6 @@ require 'enfthor'
19
19
  require 'enfapi'
20
20
  require 'json'
21
21
 
22
-
23
22
  module EnfCli
24
23
  module Cmd
25
24
  class Captive < EnfThor
@@ -137,27 +136,36 @@ module EnfCli
137
136
  desc: 'SERIAL-NUM is the serial number of the device.'
138
137
  method_option :'device-name', type: :string, default: nil, banner: 'DEVICE-NAME',
139
138
  desc: 'User-defined name for the device.'
140
- method_option :'mac-addr1', type: :string, required: true, banner: 'MAC-ADDR1',
139
+ method_option :'mac-addr1', type: :string, default: nil, banner: 'MAC-ADDR1',
141
140
  desc: 'MAC address 1 (wifi address on a wifi-enabled device)'
142
- method_option :'mac-addr2', type: :string, required: true, banner: 'MAC-ADDR2',
141
+ method_option :'mac-addr2', type: :string, default: nil, banner: 'MAC-ADDR2',
143
142
  desc: 'MAC address 2'
144
- method_option :'mac-addr3', type: :string, required: true, banner: 'MAC-ADDR3',
143
+ method_option :'mac-addr3', type: :string, default: nil, banner: 'MAC-ADDR3',
145
144
  desc: 'MAC address 3'
146
- method_option :'mac-addr4', type: :string, required: true, banner: 'MAC-ADDR4',
145
+ method_option :'mac-addr4', type: :string, default: nil, banner: 'MAC-ADDR4',
147
146
  desc: 'MAC address 4'
148
147
  method_option :'profile-id', type: :string, default: nil, banner: 'PROFILE_ID',
149
148
  desc: 'UUID of the profile that the device will use. The profile must already exist.'
150
149
  def create_device
151
150
  try_with_rescue_in_session do
152
151
  new_device_hash = {
153
- serial_number: options[:'device-id'],
154
- mac_address: {
155
- 1 => options[:'mac-addr1'],
156
- 2 => options[:'mac-addr2'],
157
- 3 => options[:'mac-addr3'],
158
- 4 => options[:'mac-addr4']
159
- }
152
+ serial_number: options[:'device-id']
160
153
  }
154
+
155
+ mac1 = options[:'mac-addr1']
156
+ mac2 = options[:'mac-addr2']
157
+ mac3 = options[:'mac-addr3']
158
+ mac4 = options[:'mac-addr4']
159
+
160
+ if mac1 or mac2 or mac3 or mac4
161
+ mac_hash = {}
162
+ mac_hash[1] = mac1 if mac1
163
+ mac_hash[2] = mac2 if mac2
164
+ mac_hash[3] = mac3 if mac3
165
+ mac_hash[4] = mac4 if mac4
166
+ new_device_hash[:mac_address] = mac_hash
167
+ end
168
+
161
169
  dev_name = options[:'device-name']
162
170
  profile_id = options[:profile_id]
163
171
  new_device_hash[:device_name] = dev_name if dev_name
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module EnfCli
17
- VERSION = '3.9.1'
17
+ VERSION = '3.9.2-alpha'
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enfcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.1
4
+ version: 3.9.2.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Venkatakumar Srinivasan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-09-14 00:00:00.000000000 Z
11
+ date: 2019-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -209,9 +209,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  required_rubygems_version: !ruby/object:Gem::Requirement
211
211
  requirements:
212
- - - ">="
212
+ - - ">"
213
213
  - !ruby/object:Gem::Version
214
- version: '0'
214
+ version: 1.3.1
215
215
  requirements: []
216
216
  rubygems_version: 3.0.1
217
217
  signing_key: