Skip to content

Commit be4ea99

Browse files
committed
Removed computed MAC address from firmware headers model
No longer necessary now that we can use the Setup API to set the API key for a device. This means you can use either the model ID or, soon, the API key. Issue: 347 Milestone: minor
1 parent b78cedf commit be4ea99

4 files changed

Lines changed: 2 additions & 19 deletions

File tree

app/actions/api/setup/show.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def provision_device model
3939
firmware_version, model_name = model.to_h.values_at :firmware_version, :model_name
4040

4141
provisioner.call model_id: find_model_id(model_name),
42-
mac_address: model.computed_mac_address,
42+
mac_address: model.mac_address,
4343
firmware_version:
4444
end
4545

app/aspects/devices/synchronizer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def call(headers) = pipe firmware_parser.call(headers), :update
2222

2323
def update result, at: Time.now
2424
result.bind do |model|
25-
device = repository.update_by_mac_address model.computed_mac_address,
25+
device = repository.update_by_mac_address model.mac_address,
2626
**model.device_attributes,
2727
synced_at: at
2828
device ? Success(device) : Failure("Unable to find device by MAC address.")

app/aspects/firmware/headers/model.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,6 @@ def initialize(**)
4141
freeze
4242
end
4343

44-
def computed_mac_address = mac_address || api_key
45-
4644
def device_attributes
4745
{
4846
battery_charge:,

spec/app/aspects/firmware/headers/model_spec.rb

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,6 @@
7070
end
7171
end
7272

73-
describe "#computed_mac_address" do
74-
it "answers MAC address when present" do
75-
expect(record.computed_mac_address).to eq("A1:B2:C3:D4:E5:F6")
76-
end
77-
78-
it "answers MAC address when MAC address isn't present but API Key is" do
79-
record = described_class[api_key: "A1:B2:C3:D4:E5:F6"]
80-
expect(record.computed_mac_address).to eq("A1:B2:C3:D4:E5:F6")
81-
end
82-
83-
it "answers nil when MAC address and API Key aren't present" do
84-
expect(described_class.new.computed_mac_address).to be(nil)
85-
end
86-
end
87-
8873
describe "#device_attributes" do
8974
it "answers device attributes" do
9075
expect(record.device_attributes).to eq(

0 commit comments

Comments
 (0)