Skip to content

Commit 8ee7222

Browse files
committed
SystemPluginsRemote, SystemPluginsMapper -> SystemStatusRemote, SystemStatusMapper
1 parent 97d3d04 commit 8ee7222

File tree

8 files changed

+49
-48
lines changed

8 files changed

+49
-48
lines changed

Networking/Networking.xcodeproj/project.pbxproj

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@
6969
02E7FFCF25621C7900C53030 /* shipping-label-print.json in Resources */ = {isa = PBXBuildFile; fileRef = 02E7FFCE25621C7900C53030 /* shipping-label-print.json */; };
7070
02F096C22406691100C0C1D5 /* media-library.json in Resources */ = {isa = PBXBuildFile; fileRef = 02F096C12406691100C0C1D5 /* media-library.json */; };
7171
077F39C8269F2C7E00ABEADC /* SystemPlugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39C7269F2C7E00ABEADC /* SystemPlugin.swift */; };
72-
077F39D426A58DE700ABEADC /* SystemPluginsMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39D326A58DE700ABEADC /* SystemPluginsMapper.swift */; };
73-
077F39D626A58E4500ABEADC /* SystemPluginsRemote.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39D526A58E4500ABEADC /* SystemPluginsRemote.swift */; };
74-
077F39D826A58EB600ABEADC /* systemPlugins.json in Resources */ = {isa = PBXBuildFile; fileRef = 077F39D726A58EB600ABEADC /* systemPlugins.json */; };
75-
077F39DA26A58ED700ABEADC /* SystemPluginsRemoteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39D926A58ED700ABEADC /* SystemPluginsRemoteTests.swift */; };
76-
077F39E626A5D15800ABEADC /* SystemPluginsMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39DB26A58F4800ABEADC /* SystemPluginsMapperTests.swift */; };
72+
077F39D426A58DE700ABEADC /* SystemStatusMapper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39D326A58DE700ABEADC /* SystemStatusMapper.swift */; };
73+
077F39D626A58E4500ABEADC /* SystemStatusRemote.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39D526A58E4500ABEADC /* SystemStatusRemote.swift */; };
74+
077F39D826A58EB600ABEADC /* systemStatus.json in Resources */ = {isa = PBXBuildFile; fileRef = 077F39D726A58EB600ABEADC /* systemStatus.json */; };
75+
077F39DA26A58ED700ABEADC /* SystemStatusRemoteTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39D926A58ED700ABEADC /* SystemStatusRemoteTests.swift */; };
76+
077F39E626A5D15800ABEADC /* SystemStatusMapperTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 077F39DB26A58F4800ABEADC /* SystemStatusMapperTests.swift */; };
7777
21DB5B99C4107CF69C0A57EC /* Pods_NetworkingTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 69314EDE650855CAF927057E /* Pods_NetworkingTests.framework */; };
7878
24F98C522502E79800F49B68 /* FeatureFlagsRemote.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24F98C512502E79800F49B68 /* FeatureFlagsRemote.swift */; };
7979
24F98C542502E8DD00F49B68 /* Bundle+Woo.swift in Sources */ = {isa = PBXBuildFile; fileRef = 24F98C532502E8DD00F49B68 /* Bundle+Woo.swift */; };
@@ -633,11 +633,11 @@
633633
02E7FFCE25621C7900C53030 /* shipping-label-print.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "shipping-label-print.json"; sourceTree = "<group>"; };
634634
02F096C12406691100C0C1D5 /* media-library.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = "media-library.json"; sourceTree = "<group>"; };
635635
077F39C7269F2C7E00ABEADC /* SystemPlugin.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemPlugin.swift; sourceTree = "<group>"; };
636-
077F39D326A58DE700ABEADC /* SystemPluginsMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemPluginsMapper.swift; sourceTree = "<group>"; };
637-
077F39D526A58E4500ABEADC /* SystemPluginsRemote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemPluginsRemote.swift; sourceTree = "<group>"; };
638-
077F39D726A58EB600ABEADC /* systemPlugins.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = systemPlugins.json; sourceTree = "<group>"; };
639-
077F39D926A58ED700ABEADC /* SystemPluginsRemoteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemPluginsRemoteTests.swift; sourceTree = "<group>"; };
640-
077F39DB26A58F4800ABEADC /* SystemPluginsMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemPluginsMapperTests.swift; sourceTree = "<group>"; };
636+
077F39D326A58DE700ABEADC /* SystemStatusMapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemStatusMapper.swift; sourceTree = "<group>"; };
637+
077F39D526A58E4500ABEADC /* SystemStatusRemote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemStatusRemote.swift; sourceTree = "<group>"; };
638+
077F39D726A58EB600ABEADC /* systemStatus.json */ = {isa = PBXFileReference; lastKnownFileType = text.json; path = systemStatus.json; sourceTree = "<group>"; };
639+
077F39D926A58ED700ABEADC /* SystemStatusRemoteTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemStatusRemoteTests.swift; sourceTree = "<group>"; };
640+
077F39DB26A58F4800ABEADC /* SystemStatusMapperTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SystemStatusMapperTests.swift; sourceTree = "<group>"; };
641641
24F98C512502E79800F49B68 /* FeatureFlagsRemote.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlagsRemote.swift; sourceTree = "<group>"; };
642642
24F98C532502E8DD00F49B68 /* Bundle+Woo.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+Woo.swift"; sourceTree = "<group>"; };
643643
24F98C552502EA4800F49B68 /* FeatureFlag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FeatureFlag.swift; sourceTree = "<group>"; };
@@ -1342,7 +1342,7 @@
13421342
02E7FFCA256218F600C53030 /* ShippingLabelRemoteTests.swift */,
13431343
D800DA0925EFEB9C001E13CE /* WCPayRemoteTests.swift */,
13441344
FE28F6EB268436C9004465C7 /* UserRemoteTests.swift */,
1345-
077F39D926A58ED700ABEADC /* SystemPluginsRemoteTests.swift */,
1345+
077F39D926A58ED700ABEADC /* SystemStatusRemoteTests.swift */,
13461346
);
13471347
path = Remote;
13481348
sourceTree = "<group>";
@@ -1467,7 +1467,7 @@
14671467
029BA4EF255D7282006171FD /* ShippingLabelRemote.swift */,
14681468
D8EDFE1D25EE87F1003D2213 /* WCPayRemote.swift */,
14691469
FE28F6E5268429B6004465C7 /* UserRemote.swift */,
1470-
077F39D526A58E4500ABEADC /* SystemPluginsRemote.swift */,
1470+
077F39D526A58E4500ABEADC /* SystemStatusRemote.swift */,
14711471
);
14721472
path = Remote;
14731473
sourceTree = "<group>";
@@ -1727,7 +1727,7 @@
17271727
3105472B262E303400C5C02B /* wcpay-payment-intent-unknown-status.json */,
17281728
31054733262E36AB00C5C02B /* wcpay-payment-intent-error.json */,
17291729
31B8D6B526583970008E3DB2 /* wcpay-account-implicitly-not-eligible.json */,
1730-
077F39D726A58EB600ABEADC /* systemPlugins.json */,
1730+
077F39D726A58EB600ABEADC /* systemStatus.json */,
17311731
);
17321732
path = Responses;
17331733
sourceTree = "<group>";
@@ -1801,7 +1801,7 @@
18011801
CC0786602677B2DA00BA9AC1 /* ShippingLabelPurchaseMapper.swift */,
18021802
CC0786C4267BAF0F00BA9AC1 /* ShippingLabelStatusMapper.swift */,
18031803
FE28F6E326842848004465C7 /* UserMapper.swift */,
1804-
077F39D326A58DE700ABEADC /* SystemPluginsMapper.swift */,
1804+
077F39D326A58DE700ABEADC /* SystemStatusMapper.swift */,
18051805
);
18061806
path = Mapper;
18071807
sourceTree = "<group>";
@@ -1866,7 +1866,7 @@
18661866
children = (
18671867
B505F6D220BEE3A500BB1B69 /* AccountMapperTests.swift */,
18681868
9387A6EF226E3F15001B53D7 /* AccountSettingsMapperTests.swift */,
1869-
077F39DB26A58F4800ABEADC /* SystemPluginsMapperTests.swift */,
1869+
077F39DB26A58F4800ABEADC /* SystemStatusMapperTests.swift */,
18701870
2685C0D9263B551300D9EE97 /* AddOnGroupMapperTests.swift */,
18711871
74AB0AC921948CE4008220CD /* CommentResultMapperTests.swift */,
18721872
45150A9F26837357006922EA /* CountryListMapperTests.swift */,
@@ -2108,7 +2108,7 @@
21082108
31054728262E2FEE00C5C02B /* wcpay-payment-intent-canceled.json in Resources */,
21092109
24F98C622502EFF600F49B68 /* feature-flags-load-all.json in Resources */,
21102110
B58D10C82114D21D00107ED4 /* generic_error.json in Resources */,
2111-
077F39D826A58EB600ABEADC /* systemPlugins.json in Resources */,
2111+
077F39D826A58EB600ABEADC /* systemStatus.json in Resources */,
21122112
CE50346721B5DCBE007573C6 /* site-plan.json in Resources */,
21132113
743E84F322172D0A00FAC9D7 /* shipment_tracking_empty.json in Resources */,
21142114
B505F6D520BEE4E700BB1B69 /* me.json in Resources */,
@@ -2453,7 +2453,7 @@
24532453
261CF1B8255AE62D0090D8D3 /* PaymentGatewayRemote.swift in Sources */,
24542454
CE0A0F1522396BF00075ED8D /* ProductAttribute.swift in Sources */,
24552455
026CF620237D69D6009563D4 /* ProductVariationsRemote.swift in Sources */,
2456-
077F39D626A58E4500ABEADC /* SystemPluginsRemote.swift in Sources */,
2456+
077F39D626A58E4500ABEADC /* SystemStatusRemote.swift in Sources */,
24572457
4599FC5E24A62AA70056157A /* ProductTagsRemote.swift in Sources */,
24582458
FE28F6E226840DED004465C7 /* User.swift in Sources */,
24592459
7426CA0F21AF2C90004E9FFC /* SiteAPI.swift in Sources */,
@@ -2543,7 +2543,7 @@
25432543
B557DA0B20975D7E005962F4 /* WooAPIVersion.swift in Sources */,
25442544
45150A9E26836A57006922EA /* CountryListMapper.swift in Sources */,
25452545
CE6BFEE82236D133005C79FB /* ProductDimensions.swift in Sources */,
2546-
077F39D426A58DE700ABEADC /* SystemPluginsMapper.swift in Sources */,
2546+
077F39D426A58DE700ABEADC /* SystemStatusMapper.swift in Sources */,
25472547
45152811257A81730076B03C /* ProductAttributeMapper.swift in Sources */,
25482548
B505F6D120BEE39600BB1B69 /* AccountRemote.swift in Sources */,
25492549
B567AF2B20A0FA4200AB6C62 /* OrderListMapper.swift in Sources */,
@@ -2602,7 +2602,7 @@
26022602
B5C6FCC820A32E4800A4F8E4 /* DateFormatterWooTests.swift in Sources */,
26032603
74C8F06A20EEBC8C00B6EDC9 /* OrderMapperTests.swift in Sources */,
26042604
45152835257A8F490076B03C /* ProductAttributeListMapperTests.swift in Sources */,
2605-
077F39DA26A58ED700ABEADC /* SystemPluginsRemoteTests.swift in Sources */,
2605+
077F39DA26A58ED700ABEADC /* SystemStatusRemoteTests.swift in Sources */,
26062606
31D27C952602B737002EDB1D /* SitePluginsRemoteTests.swift in Sources */,
26072607
74AB5B4D21AF354E00859C12 /* SiteAPIMapperTests.swift in Sources */,
26082608
93D8BC01226BC20600AD2EB3 /* AccountSettingsRemoteTests.swift in Sources */,
@@ -2635,7 +2635,7 @@
26352635
020C907F24C7D359001E2BEB /* ProductVariationMapperTests.swift in Sources */,
26362636
74ABA1D5213F26B300FFAD30 /* TopEarnerStatsMapperTests.swift in Sources */,
26372637
74AB5B5121AF426D00859C12 /* SiteAPIRemoteTests.swift in Sources */,
2638-
077F39E626A5D15800ABEADC /* SystemPluginsMapperTests.swift in Sources */,
2638+
077F39E626A5D15800ABEADC /* SystemStatusMapperTests.swift in Sources */,
26392639
4599FC6624A633A10056157A /* ProductTagsRemoteTests.swift in Sources */,
26402640
B567AF2F20A0FB8F00AB6C62 /* AuthenticatedRequestTests.swift in Sources */,
26412641
B5C6FCCD20A34B8300A4F8E4 /* OrderListMapperTests.swift in Sources */,

Networking/Networking/Mapper/SystemPluginsMapper.swift renamed to Networking/Networking/Mapper/SystemStatusMapper.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
22

3-
/// Mapper: SystemPlugins
3+
/// Mapper: System Status
44
///
5-
struct SystemPluginsMapper: Mapper {
5+
struct SystemStatusMapper: Mapper {
66

77
/// Site Identifier associated to the system plugins that will be parsed.
88
/// We're injecting this field via `JSONDecoder.userInfo` because the remote endpoints don't return the SiteID in the system plugin endpoint.

Networking/Networking/Remote/SystemPluginsRemote.swift renamed to Networking/Networking/Remote/SystemStatusRemote.swift

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import Foundation
22

3-
/// SystemPlugins: Remote Endpoints
3+
/// System Status: Remote Endpoint
44
///
5-
public class SystemPluginsRemote: Remote {
5+
public class SystemStatusRemote: Remote {
66

77
/// Retrieves all of the `SystemPlugin`s for a given site.
88
///
@@ -12,26 +12,27 @@ public class SystemPluginsRemote: Remote {
1212
///
1313
public func loadSystemPlugins(for siteID: Int64,
1414
completion: @escaping (Result<[SystemPlugin], Error>) -> Void) {
15-
let path = Constants.systemPluginsPath
15+
let path = Constants.systemStatusPath
1616
let parameters = [
17-
ParameterKeys.fields: ParameterValues.activeFieldValues
17+
ParameterKeys.fields: [ParameterValues.activePlugins, ParameterValues.inactivePlugins]
1818
]
1919
let request = JetpackRequest(wooApiVersion: .mark3, method: .get, siteID: siteID, path: path, parameters: parameters)
20-
let mapper = SystemPluginsMapper(siteID: siteID)
20+
let mapper = SystemStatusMapper(siteID: siteID)
2121

2222
enqueue(request, mapper: mapper, completion: completion)
2323
}
2424
}
2525

2626
// MARK: - Constants!
2727
//
28-
private extension SystemPluginsRemote {
28+
private extension SystemStatusRemote {
2929
enum Constants {
30-
static let systemPluginsPath: String = "system_status"
30+
static let systemStatusPath: String = "system_status"
3131
}
3232

3333
enum ParameterValues {
34-
static let activeFieldValues: String = "active_plugins"
34+
static let activePlugins: String = "active_plugins"
35+
static let inactivePlugins: String = "inactive_plugins"
3536
}
3637

3738
enum ParameterKeys {

Networking/NetworkingTests/Mapper/SystemPluginsMapperTests.swift renamed to Networking/NetworkingTests/Mapper/SystemStatusMapperTests.swift

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import XCTest
22
@testable import Networking
33

4-
/// SystemPluginsMapper Unit Tests
4+
/// SystemStatusMapperTests Unit Tests
55
///
6-
class SystemPluginsMapperTests: XCTestCase {
6+
class SystemStatusMapperTests: XCTestCase {
77

88
/// Dummy Site ID.
99
///
@@ -24,7 +24,7 @@ class SystemPluginsMapperTests: XCTestCase {
2424
let expectedNetworkActivated = false
2525

2626
// When
27-
let systemPlugins = try mapLoadSystemPluginsResponse()
27+
let systemPlugins = try mapLoadSystemStatusResponse()
2828

2929
// Then
3030
XCTAssertEqual(systemPlugins.count, 3)
@@ -45,21 +45,21 @@ class SystemPluginsMapperTests: XCTestCase {
4545

4646
/// Private Methods.
4747
///
48-
private extension SystemPluginsMapperTests {
48+
private extension SystemStatusMapperTests {
4949

50-
/// Returns the SystemPluginsMapper output upon receiving `filename` (Data Encoded)
50+
/// Returns the SystemStatusMapper output upon receiving `filename` (Data Encoded)
5151
///
5252
func mapPlugins(from filename: String) throws -> [SystemPlugin] {
5353
guard let response = Loader.contentsOf(filename) else {
5454
return []
5555
}
5656

57-
return try SystemPluginsMapper(siteID: dummySiteID).map(response: response)
57+
return try SystemStatusMapper(siteID: dummySiteID).map(response: response)
5858
}
5959

60-
/// Returns the SystemPluginsMapper output upon receiving `systemPlugins`
60+
/// Returns the SystemStatusMapper output upon receiving `systemPlugins`
6161
///
62-
func mapLoadSystemPluginsResponse() throws -> [SystemPlugin] {
63-
return try mapPlugins(from: "systemPlugins")
62+
func mapLoadSystemStatusResponse() throws -> [SystemPlugin] {
63+
return try mapPlugins(from: "systemStatus")
6464
}
6565
}

Networking/NetworkingTests/Remote/SystemPluginsRemoteTests.swift renamed to Networking/NetworkingTests/Remote/SystemStatusRemoteTests.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import XCTest
22
@testable import Networking
33

4-
/// SystemPluginsRemote Unit Tests
4+
/// SystemStatusRemote Unit Tests
55
///
6-
class SystemPluginsRemoteTests: XCTestCase {
6+
class SystemStatusRemoteTests: XCTestCase {
77

88
/// Dummy Network Wrapper
99
///
@@ -25,9 +25,9 @@ class SystemPluginsRemoteTests: XCTestCase {
2525
/// Verifies that loadSystemPlugins properly parses the sample response.
2626
///
2727
func test_loadSystemPlugins_properly_returns_systemPlugins() {
28-
let remote = SystemPluginsRemote(network: network)
28+
let remote = SystemStatusRemote(network: network)
2929

30-
network.simulateResponse(requestUrlSuffix: "system_status", filename: "systemPlugins")
30+
network.simulateResponse(requestUrlSuffix: "system_status", filename: "systemStatus")
3131

3232
// When
3333
let result: Result<[SystemPlugin], Error> = waitFor { promise in
@@ -48,7 +48,7 @@ class SystemPluginsRemoteTests: XCTestCase {
4848
/// Verifies that loadSystemPlugins properly relays Networking Layer errors.
4949
///
5050
func test_loadSystemPlugins_properly_relays_netwoking_errors() {
51-
let remote = SystemPluginsRemote(network: network)
51+
let remote = SystemStatusRemote(network: network)
5252

5353
// When
5454
let result: Result<[SystemPlugin], Error> = waitFor { promise in

Networking/NetworkingTests/Responses/systemPlugins.json renamed to Networking/NetworkingTests/Responses/systemStatus.json

File renamed without changes.

Yosemite/Yosemite/Stores/SystemStatusStore.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import Storage
55
/// Implements `SystemStatusActions` actions
66
///
77
public final class SystemStatusStore: Store {
8-
private let remote: SystemPluginsRemote
8+
private let remote: SystemStatusRemote
99

1010
public override init(dispatcher: Dispatcher, storageManager: StorageManagerType, network: Network) {
11-
self.remote = SystemPluginsRemote(network: network)
11+
self.remote = SystemStatusRemote(network: network)
1212
super.init(dispatcher: dispatcher, storageManager: storageManager, network: network)
1313
}
1414

Yosemite/YosemiteTests/Stores/SystemStatusStoreTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class SystemStatusStoreTests: XCTestCase {
3737

3838
func test_synchronizeSystemPlugins_stores_systemPlugins_correctly() {
3939
// Given
40-
network.simulateResponse(requestUrlSuffix: "system_status", filename: "systemPlugins")
40+
network.simulateResponse(requestUrlSuffix: "system_status", filename: "systemStatus")
4141
let store = SystemStatusStore(dispatcher: dispatcher, storageManager: storageManager, network: network)
4242

4343
// When
@@ -61,7 +61,7 @@ class SystemStatusStoreTests: XCTestCase {
6161
storedStaleSystemPlugin.update(with: staleSystemPlugin)
6262
XCTAssertEqual(viewStorage.countObjects(ofType: StorageSystemPlugin.self), 1)
6363

64-
network.simulateResponse(requestUrlSuffix: "system_status", filename: "systemPlugins")
64+
network.simulateResponse(requestUrlSuffix: "system_status", filename: "systemStatus")
6565
let store = SystemStatusStore(dispatcher: dispatcher, storageManager: storageManager, network: network)
6666

6767
// When

0 commit comments

Comments
 (0)