Added test for minimal example. Omit optional values when not set. Added messages for route info, production drop and route end.
This commit is contained in:
parent
9525e7b97f
commit
df964e0ecf
9 changed files with 283 additions and 8 deletions
46
production_drop.go
Normal file
46
production_drop.go
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package feragstring
|
||||
|
||||
import "fmt"
|
||||
|
||||
type ProductionDrop struct {
|
||||
FeragMessage
|
||||
agentName string
|
||||
numberOfCopies int
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) NumberOfCopies() string {
|
||||
return fmt.Sprintf("+13%05d", pd.numberOfCopies)
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) SetNumberOfCopies(numberOfCopies int) {
|
||||
pd.numberOfCopies = numberOfCopies
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) AgentName() string {
|
||||
return fmt.Sprintf("+12%-10s", pd.agentName)
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) SetAgentName(agentName string) {
|
||||
pd.agentName = agentName
|
||||
}
|
||||
|
||||
func NewProductionDrop() *ProductionDrop {
|
||||
pd := ProductionDrop{
|
||||
FeragMessage: FeragMessage{
|
||||
messageStart: "2403",
|
||||
messageEnd: "!",
|
||||
},
|
||||
}
|
||||
return &pd
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) Payload() string {
|
||||
data := pd.AgentName()
|
||||
data += pd.NumberOfCopies()
|
||||
return data
|
||||
}
|
||||
|
||||
func (pd *ProductionDrop) Message() string {
|
||||
message := pd.FeragMessage.MessageTemplate()
|
||||
return message(&pd.FeragMessage, pd.Payload())
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue