Doc update mostly for examples

This commit is contained in:
Dominic Bosch 2014-04-28 23:26:36 +02:00
parent 4b73d9b7c5
commit ce36359539
9 changed files with 123 additions and 112 deletions

View file

@ -1,8 +1,10 @@
### ###
EmailYak ACTION INVOKER EmailYak ACTION INVOKER
------------------------ ------------------------
# #
# Requires user params: # Requires user params:
# - apikey: The user's EmailYak API key # - apikey: The user's EmailYak API key
### ###
@ -26,10 +28,10 @@ standardCallback = ( funcName ) ->
### ###
Send a mail through Emailyak. Send a mail through Emailyak.
@param sender The email address belonging to your apikey - sender The email address belonging to your apikey
@param receipient The email address for the one that receives the mail - receipient The email address for the one that receives the mail
@param subject The subject of the mail - subject The subject of the mail
@param content The content of the mail - content The content of the mail
### ###
exports.sendMail = ( sender, receipient, subject, content ) -> exports.sendMail = ( sender, receipient, subject, content ) ->
if typeof content isnt "string" if typeof content isnt "string"

View file

@ -3,7 +3,7 @@
# Converts text to speech and issues an event into th system on completion # Converts text to speech and issues an event into th system on completion
# #
# Requires user-specific parameters: # Requires user-specific parameters:
#
# - emailaccount # - emailaccount
# - accountid # - accountid
# - loginkey # - loginkey
@ -29,22 +29,22 @@ arrFormats = [
"FORMAT_MUWAV" # (8bit Mu-law PCM Wave) "FORMAT_MUWAV" # (8bit Mu-law PCM Wave)
] ]
# oResponseCodes = # oResponseCodes =
# "0": "success" # "0": "success"
# "-1": "invalid login" # "-1": "invalid login"
# "-2": "account inactive" # "-2": "account inactive"
# "-3": "account unauthorized" # "-3": "account unauthorized"
# "-4": "invalid or inactive login key" # "-4": "invalid or inactive login key"
# "-5": "invalid conversion number lookup" # "-5": "invalid conversion number lookup"
# "-6": "content size is too large (only for “Basic” subscribers)" # "-6": "content size is too large (only for “Basic” subscribers)"
# "-7": "monthly allowance has been exceeded (only for “Basic” subscribers)" # "-7": "monthly allowance has been exceeded (only for “Basic” subscribers)"
# "-10": "invalid TTS Voice ID" # "-10": "invalid TTS Voice ID"
# "-11": "invalid TTS Output Format ID" # "-11": "invalid TTS Output Format ID"
# "-12": "invalid REST request" # "-12": "invalid REST request"
# "-13": "invalid or unavailable TTS Sample Rate" # "-13": "invalid or unavailable TTS Sample Rate"
# "1": "invalid SSML (not a valid XML document)" # "1": "invalid SSML (not a valid XML document)"
# "2": "invalid SSML (SSML content must begin with a “speak” tag)" # "2": "invalid SSML (SSML content must begin with a “speak” tag)"
# "3": "invalid SSML (“lexicon” tag is not supported)" # "3": "invalid SSML (“lexicon” tag is not supported)"
parseAnswer = ( body ) -> parseAnswer = ( body ) ->
arrSelectors = body.match /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g arrSelectors = body.match /(\S+)=["']?((?:.(?!["']?\s+(?:\S+)=|[>"']))+.)["']?/g
@ -55,6 +55,7 @@ parseAnswer = ( body ) ->
oAnswer oAnswer
# Function arguments: # Function arguments:
# - text: the text to be translated into voice # - text: the text to be translated into voice
# - idVoice: index of the voice used for conversion from the arrVoices array. # - idVoice: index of the voice used for conversion from the arrVoices array.
# - idAudioFormat: index of the voice used for conversion from the arrVoices array. # - idAudioFormat: index of the voice used for conversion from the arrVoices array.

View file

@ -31,11 +31,11 @@ standardCallback = ( funcName ) ->
### ###
Call the ProBinder service with the given parameters. Call the ProBinder service with the given parameters.
@param {Object} args the required function arguments object - {Object} args the required function arguments object
@param {Object} [args.data] the data to be posted - {Object} [args.data] the data to be posted
@param {String} args.service the required service identifier to be appended to the url - {String} args.service the required service identifier to be appended to the url
@param {String} args.method the required method identifier to be appended to the url - {String} args.method the required method identifier to be appended to the url
@param {function} [args.callback] the function to receive the request answer - {function} [args.callback] the function to receive the request answer
### ###
callService = ( args ) -> callService = ( args ) ->
if not args.service or not args.method if not args.service or not args.method
@ -50,9 +50,9 @@ callService = ( args ) ->
### ###
Does everything to post something in a binder Does everything to post something in a binder
@param {String} companyId the comany associated to the binder - {String} companyId the comany associated to the binder
@param {String} contextId the binder id - {String} contextId the binder id
@param {String} content the content to be posted - {String} content the content to be posted
### ###
exports.newContent = ( companyId, contextId, content ) -> exports.newContent = ( companyId, contextId, content ) ->
if arguments[ 4 ] if arguments[ 4 ]
@ -71,8 +71,8 @@ exports.newContent = ( companyId, contextId, content ) ->
### ###
Does everything to post a file info in a binder tab Does everything to post a file info in a binder tab
@param {String} fromService the content service which grabs the content - {String} fromService the content service which grabs the content
@param {String} fromId the content id from which the information is grabbed - {String} fromId the content id from which the information is grabbed
### ###
exports.makeFileEntry = ( fromService, fromId, toCompany, toContext ) -> exports.makeFileEntry = ( fromService, fromId, toCompany, toContext ) ->
getContent getContent
@ -87,11 +87,11 @@ exports.makeFileEntry = ( fromService, fromId, toCompany, toContext ) ->
### ###
Calls the content get service with the content id and the service id provided. Calls the content get service with the content id and the service id provided.
@param {Object} args the object containing the service id and the content id, - {Object} args the object containing the service id and the content id,
success and error callback methods success and error callback methods
@param {String} args.serviceid the service id that is able to process this content - {String} args.serviceid the service id that is able to process this content
@param {String} args.contentid the content id - {String} args.contentid the content id
@param {function} [args.callback] receives the needle answer from the "call" function - {function} [args.callback] receives the needle answer from the "call" function
### ###
getContent = ( args ) -> getContent = ( args ) ->
if not args.callback if not args.callback
@ -107,7 +107,7 @@ getContent = ( args ) ->
### ###
Sets the content as read. Sets the content as read.
@param {Object} id the content id to be set to read. - {Object} id the content id to be set to read.
### ###
exports.setRead = ( id ) -> exports.setRead = ( id ) ->
callService callService

View file

@ -3,6 +3,7 @@ Remote Engine
------------- -------------
# #
# Requires user params: # Requires user params:
# - eventname: The event type to be pushed into the system # - eventname: The event type to be pushed into the system
# - webhook: The url to the emote webhook that will receive the event # - webhook: The url to the emote webhook that will receive the event
### ###
@ -14,7 +15,7 @@ options =
### ###
Push an event into a WebAPI engine. Push an event into a WebAPI engine.
@param {Object} evt The event object that will be transmitted. - {Object} evt The event object that will be transmitted.
### ###
exports.pushEvent = ( evt ) -> exports.pushEvent = ( evt ) ->
if not evt if not evt

View file

@ -8,6 +8,7 @@ This is a customized module, made for Robert Frank to automatically create
courses binders and prefill them with data. courses binders and prefill them with data.
This module requires user-specific parameters: This module requires user-specific parameters:
- binderUsername - binderUsername
- binderPassword - binderPassword
- importIoUserGuid - importIoUserGuid
@ -305,6 +306,7 @@ exports.createSemester = ( semester ) ->
# Expects # Expects
# - semester # - semester
# - studies # - studies
# - major # - major

View file

@ -3,6 +3,7 @@
# --------------------- # ---------------------
# #
# Requires user params: # Requires user params:
# - apikey: The user's EmailYak API key # - apikey: The user's EmailYak API key
# #
@ -24,27 +25,28 @@ exports.newMail = () ->
log "#{ body.Emails.length } mail events pushed into the system" log "#{ body.Emails.length } mail events pushed into the system"
pushEvent mail for mail in body.Emails pushEvent mail for mail in body.Emails
###
This will emit events of the form:
( Refer to http://docs.emailyak.com/get-new-email.html for more information. )
{ # This will emit events of the form:
"EmailID": "xquukd5z",
"Received": "2014-04-19T11:27:11", # ( Refer to http://docs.emailyak.com/get-new-email.html for more information. )
"ToAddress": "test@mscliveweb.simpleyak.com",
"ParsedData": [ # {
{ # "EmailID": "xquukd5z",
"Data": "Best Regards\nTest User", # "Received": "2014-04-19T11:27:11",
"Part": 0, # "ToAddress": "test@mscliveweb.simpleyak.com",
"Type": "Email" # "ParsedData": [
} # {
], # "Data": "Best Regards\nTest User",
"FromName": "Test User", # "Part": 0,
"ToAddressList": "test@mscliveweb.simpleyak.com", # "Type": "Email"
"FromAddress": "test.address@provider.com", # }
"HtmlBody": "Best Regards\nTest User", # ],
"CcAddressList": "", # "FromName": "Test User",
"TextBody": "Best Regards\nTest User", # "ToAddressList": "test@mscliveweb.simpleyak.com",
"Subject": "test subject" # "FromAddress": "test.address@provider.com",
} # "HtmlBody": "Best Regards\nTest User",
### # "CcAddressList": "",
# "TextBody": "Best Regards\nTest User",
# "Subject": "test subject"
# }

View file

@ -57,18 +57,19 @@ exports.weekData = ( idCity ) ->
connectorGuids: [ "2a1d789a-4d24-4942-bdca-ffa0e9f99c85" ] connectorGuids: [ "2a1d789a-4d24-4942-bdca-ffa0e9f99c85" ]
queryService params, ( data ) -> queryService params, ( data ) ->
pushEvent data pushEvent data
# [
# { # [
# wind: '9 mph', # {
# day_identifier: 'Today', # wind: '9 mph',
# day_name: 'Mon', # day_identifier: 'Today',
# temp_max: '61 °F', # day_name: 'Mon',
# temp_min: '50 °F', # temp_max: '61 °F',
# sunlight: '0 h', # temp_min: '50 °F',
# rain: '0-2mm' # sunlight: '0 h',
# }, # rain: '0-2mm'
# [...] # },
# ] # [...]
# ]
exports.currentData = ( idCity ) -> exports.currentData = ( idCity ) ->
params = params =
@ -76,14 +77,14 @@ exports.currentData = ( idCity ) ->
connectorGuids: [ "06394265-b4e1-4b48-be82-a9f2acb9040f" ] connectorGuids: [ "06394265-b4e1-4b48-be82-a9f2acb9040f" ]
queryService params, ( data ) -> queryService params, ( data ) ->
pushEvent data pushEvent data
# [ # [
# { # {
# current_time_wind_desc: '01:00 | Overcast', # current_time_wind_desc: '01:00 | Overcast',
# current_temp: '53°F', # current_temp: '53°F',
# coordinates: '47.56°N 7.59°E 260m asl', # coordinates: '47.56°N 7.59°E 260m asl',
# city: 'Basel-Stadt' # city: 'Basel-Stadt'
# } # }
# ] # ]
# Helper function to detect and convert temperatures # Helper function to detect and convert temperatures

View file

@ -4,6 +4,7 @@ ProBinder EVENT POLLER
Global variables Global variables
This module requires user-specific parameters: This module requires user-specific parameters:
- username - username
- password - password
### ###
@ -29,11 +30,11 @@ standardCallback = ( funcName ) ->
### ###
Call the ProBinder service with the given parameters. Call the ProBinder service with the given parameters.
@param {Object} args the required function arguments object - {Object} args the required function arguments object
@param {Object} [args.data] the data to be posted - {Object} [args.data] the data to be posted
@param {String} args.service the required service identifier to be appended to the url - {String} args.service the required service identifier to be appended to the url
@param {String} args.method the required method identifier to be appended to the url - {String} args.method the required method identifier to be appended to the url
@param {function} [args.callback] the function to receive the request answer - {function} [args.callback] the function to receive the request answer
### ###
callService = ( args ) -> callService = ( args ) ->
if not args.service or not args.method if not args.service or not args.method
@ -89,30 +90,30 @@ getContent = ( args ) ->
service: args.contentServiceId service: args.contentServiceId
callback: args.callback callback: args.callback
# Returns an event of the form: # Returns an event of the form:
#
# { # {
# "text": "test subject", # "text": "test subject",
# "id": 127815, # "id": 127815,
# "createDate": "2014-04-19 16:27:45", # "createDate": "2014-04-19 16:27:45",
# "lastModified": "2014-04-19 16:27:45", # "lastModified": "2014-04-19 16:27:45",
# "time": "5 days ago", # "time": "5 days ago",
# "userId": 10595, # "userId": 10595,
# "username": "Dominic Bosch", # "username": "Dominic Bosch",
# "uri": "https://probinder.com/content/view/id/127815/", # "uri": "https://probinder.com/content/view/id/127815/",
# "localUri": "https://probinder.com/content/view/id/127815/", # "localUri": "https://probinder.com/content/view/id/127815/",
# "title": "", # "title": "",
# "serviceId": 27, # "serviceId": 27,
# "userIds": [ # "userIds": [
# 10595 # 10595
# ], # ],
# "description": "", # "description": "",
# "context": [ # "context": [
# { # {
# "id": 18749, # "id": 18749,
# "name": "WebAPI ECA Test Binder", # "name": "WebAPI ECA Test Binder",
# "remove": true, # "remove": true,
# "uri": "/content/context/id/18749/webapi-eca-test-binder" # "uri": "/content/context/id/18749/webapi-eca-test-binder"
# } # }
# ] # ]
# } # }

View file

@ -9,6 +9,7 @@ require( 'groc' ).CLI(
"README.md", "README.md",
"LICENSE.md", "LICENSE.md",
"coffee/*.coffee", "coffee/*.coffee",
"examples/*/**",
"-o./webpages/public/doc" "-o./webpages/public/doc"
], ],
function( err ) { function( err ) {