Skip to content
This repository was archived by the owner on Jul 21, 2020. It is now read-only.

Commit d09aa42

Browse files
committed
Fix capitalization and property names
1 parent 3cce1c8 commit d09aa42

16 files changed

+54
-50
lines changed

BeamAPI.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "BeamAPI"
3-
s.version = "1.2"
3+
s.version = "1.2.1"
44
s.summary = "An interface to communicate with Beam's backend."
55
s.homepage = "https://github.com/WatchBeam/beam-client-swift"
66
s.license = "MIT"

Example/Tests/InteractiveClientTests.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class InteractiveClientTests: XCTestCase, InteractiveClientDelegate {
3131

3232
self.channel = channel
3333

34-
BeamClient.sharedClient.Interactive.getInteractiveDataByChannel(self.channel.id) { (data, error) in
34+
BeamClient.sharedClient.interactive.getInteractiveDataByChannel(self.channel.id) { (data, error) in
3535
guard let address = data?.address else {
3636
XCTFail()
3737
return
@@ -47,22 +47,22 @@ class InteractiveClientTests: XCTestCase, InteractiveClientDelegate {
4747
}
4848

4949
func testConnect() {
50-
expectation = expectationWithDescription("test joining a channel through Interactive")
50+
expectation = expectationWithDescription("test joining a channel with interactive capabilities")
5151

5252
client = InteractiveClient(delegate: self)
5353
client.connect(url: address, channelId: channel.id)
5454

5555
waitForExpectationsWithTimeout(10, handler: nil)
5656
}
5757

58-
func InteractiveDidConnect() {
58+
func interactiveDidConnect() {
5959
client.disconnect()
6060
}
6161

62-
func InteractiveDidDisconnect() {
62+
func interactiveDidDisconnect() {
6363
expectation.fulfill()
6464
}
6565

66-
func InteractiveChangedState(state: String) {}
67-
func InteractiveReceivedPacket(packet: InteractivePacket) {}
66+
func interactiveChangedState(state: String) {}
67+
func interactiveReceivedPacket(packet: InteractivePacket) {}
6868
}

Example/Tests/InteractiveTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class InteractiveTests: XCTestCase {
1414
let channelId = 50772
1515

1616
func testInteractiveData() {
17-
let expectation = expectationWithDescription("tests the Interactive data endpoint")
17+
let expectation = expectationWithDescription("tests the interactive data endpoint")
1818

19-
BeamClient.sharedClient.Interactive.getInteractiveDataByChannel(channelId) { (data, error) in
19+
BeamClient.sharedClient.interactive.getInteractiveDataByChannel(channelId) { (data, error) in
2020
XCTAssertNotNil(data)
2121
XCTAssertNil(error)
2222
expectation.fulfill()

Pod/Classes/Clients/BeamClient.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ public class BeamClient {
2929
/// The property through which all ingest methods are accessed.
3030
public let ingests: IngestsRoutes
3131

32+
/// The property through which all interactive methods are accessed.
33+
public let interactive: InteractiveRoutes
34+
3235
/// The property through which all notification methods are accessed.
3336
public let notifications: NotificationsRoutes
3437

@@ -44,9 +47,6 @@ public class BeamClient {
4447
/// The property through which all team methods are accessed.
4548
public let teams: TeamsRoutes
4649

47-
/// The property through which all Interactive methods are accessed.
48-
public let Interactive: InteractiveRoutes
49-
5050
/// The property through which all type methods are accessed.
5151
public let types: TypesRoutes
5252

@@ -59,12 +59,12 @@ public class BeamClient {
5959
channels = ChannelsRoutes()
6060
chat = ChatRoutes()
6161
ingests = IngestsRoutes()
62+
interactive = InteractiveRoutes()
6263
notifications = NotificationsRoutes()
6364
oauth = OAuthRoutes()
6465
recordings = RecordingsRoutes()
6566
shop = ShopRoutes()
6667
teams = TeamsRoutes()
67-
Interactive = InteractiveRoutes()
6868
types = TypesRoutes()
6969
users = UsersRoutes()
7070
}

Pod/Classes/Clients/InteractiveClient.swift

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import Starscream
1010
import SwiftyJSON
1111

12-
/// Used to connect to a channel's interactive controls through our Interactive protocol.
12+
/// Used to connect to a channel's interactive controls through our interactive protocol.
1313
public class InteractiveClient: WebSocketDelegate {
1414

1515
// MARK: Properties
@@ -26,25 +26,25 @@ public class InteractiveClient: WebSocketDelegate {
2626
/// The id of the authenticated user in the app.
2727
private var userId: Int?
2828

29-
/// The current Interactive control state.
29+
/// The current interactive control state.
3030
private var state: String?
3131

3232
/// The websocket through which control updates are received and sent.
3333
private var socket: WebSocket?
3434

3535
/// Initializes an interactive connection, which needs to be stored by your own class.
36-
public init(delegate InteractiveDelegate: InteractiveClientDelegate) {
37-
delegate = InteractiveDelegate
36+
public init(delegate interactiveDelegate: InteractiveClientDelegate) {
37+
delegate = interactiveDelegate
3838
}
3939

4040
// MARK: Public Methods
4141

4242
/**
4343
Connects to an interactive channel given data that is received with InteractiveRoutes.getInteractiveDataByChannel
4444

45-
:param: url The base URL of the Interactive server being connected to.
45+
:param: url The base URL of the interactive server being connected to.
4646
:param: channelId The id of the channel being connected to.
47-
:param: key The key used to authenticate with Interactive.
47+
:param: key The key used to authenticate with interactive.
4848
:param: userId The id of the authenticated user in the app.
4949
*/
5050
public func connect(url baseUrl: String, channelId: Int, key: String? = nil, userId: Int? = nil) {
@@ -61,13 +61,13 @@ public class InteractiveClient: WebSocketDelegate {
6161
socket?.connect()
6262
}
6363

64-
/// Disconnects from the Interactive server.
64+
/// Disconnects from the interactive server.
6565
public func disconnect() {
6666
self.socket?.disconnect()
6767
}
6868

6969
/**
70-
Sends a packet to the Interactive server.
70+
Sends a packet to the interactive server.
7171

7272
:param: packet The packet being sent.
7373
*/
@@ -86,14 +86,14 @@ public class InteractiveClient: WebSocketDelegate {
8686
private func updateState(state: String) {
8787
if state != self.state {
8888
self.state = state
89-
delegate?.InteractiveChangedState(state)
89+
delegate?.interactiveChangedState(state)
9090
}
9191
}
9292

9393
// MARK: WebSocketDelegate
9494

9595
public func websocketDidConnect(socket: WebSocket) {
96-
delegate?.InteractiveDidConnect()
96+
delegate?.interactiveDidConnect()
9797

9898
guard let authKey = authKey,
9999
userId = userId else {
@@ -108,13 +108,13 @@ public class InteractiveClient: WebSocketDelegate {
108108
}
109109

110110
public func websocketDidDisconnect(socket: WebSocket, error: NSError?) {
111-
delegate?.InteractiveDidDisconnect()
111+
delegate?.interactiveDidDisconnect()
112112
}
113113

114114
public func websocketDidReceiveMessage(socket: WebSocket, text: String) {
115115
if let (packet, state) = InteractivePacket.receivePacket(text) {
116116
if let packet = packet {
117-
delegate?.InteractiveReceivedPacket(packet)
117+
delegate?.interactiveReceivedPacket(packet)
118118
}
119119

120120
if let state = state {
@@ -127,18 +127,18 @@ public class InteractiveClient: WebSocketDelegate {
127127
}
128128
}
129129

130-
/// The Interactive client's delegate, through which information is relayed to your app.
130+
/// The interactive client's delegate, through which information is relayed to your app.
131131
public protocol InteractiveClientDelegate: class {
132132

133-
/// Called when a connection is made to the Interactive server.
134-
func InteractiveDidConnect()
133+
/// Called when a connection is made to the interactive server.
134+
func interactiveDidConnect()
135135

136136
/// Called when the client disconnects, whether on purpose or due to an error.
137-
func InteractiveDidDisconnect()
137+
func interactiveDidDisconnect()
138138

139139
/// Called when the control state is changed by the broadcaster.
140-
func InteractiveChangedState(state: String)
140+
func interactiveChangedState(state: String)
141141

142142
/// Called when a packet is received and interpreted.
143-
func InteractiveReceivedPacket(packet: InteractivePacket)
143+
func interactiveReceivedPacket(packet: InteractivePacket)
144144
}

Pod/Classes/Models/BeamChannel.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public struct BeamChannel {
5959
/// True if the channel's content is interactive.
6060
public let interactive: Bool
6161

62-
/// The id of the Interactive game being used by the channel.
63-
public let InteractiveGameId: Int?
62+
/// The id of the interactive game being used by the channel.
63+
public let interactiveGameId: Int?
6464

6565
/// FTL is enabled if this value is > 0.
6666
public let ftl: Int
@@ -163,7 +163,7 @@ public struct BeamChannel {
163163
desc = json["description"].string
164164
typeId = json["typeId"].int
165165
interactive = json["interactive"].bool ?? (json["interactive"].int ?? 0) == 1
166-
InteractiveGameId = json["InteractiveGameId"].int
166+
interactiveGameId = json["tetrisGameId"].int
167167
ftl = json["ftl"].int ?? 0
168168
hasVod = json["hasVod"].bool ?? false
169169
createdAt = NSDate.fromBeam(json["createdAt"].string)

Pod/Classes/Models/Constellation/ConstellationPacket.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ public class ConstellationPacket {
1414
/// The string of the packet's raw JSON data.
1515
private var packetString: String?
1616

17+
/// Initializes an empty constellation packet.
18+
public init() {
19+
}
20+
1721
class func prepareToSend(packet: ConstellationSendable) -> String {
1822
let packet = [
1923
"type": "method",

Pod/Classes/Models/Interactive/InteractiveControl.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import SwiftyJSON
1010

11-
/// A base Interactive control object.
11+
/// A base interactive control object.
1212
public class InteractiveControl {
1313

1414
/// The control's blueprint, containing valid configurations.

Pod/Classes/Models/Interactive/InteractiveData.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ import SwiftyJSON
1111
/// Holds data retrieved by InteractiveRoutes.getInteractiveDataByChannel.
1212
public struct InteractiveData {
1313

14-
/// The URL address of the Interactive server that should be connected to.
14+
/// The URL address of the interactive server that should be connected to.
1515
public let address: String?
1616

17-
/// The key used for authentication with the Interactive servers.
17+
/// The key used for authentication with the interactive servers.
1818
public let key: String?
1919

2020
/// The id of the user being authenticated.

Pod/Classes/Models/Interactive/InteractiveVersion.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import SwiftyJSON
1010

11-
/// The version of Interactive controls being used by a channel.
11+
/// The version of interactive controls being used by a channel.
1212
public struct InteractiveVersion {
1313

1414
/// The version's identifier.

0 commit comments

Comments
 (0)