Gist-class

Class to handle gists (https://gist.github.com/)

Author

hoppfrosch

Credits

License

WTFPL (http://sam.zoy.org/wtfpl/)

Changelog

0.3.0 (20130816)hoppfrosch (Internal reorganization concerning documentation) - #1,#2
0.2.0 (20130102)hoppfrosch (Create new gist & delete existing gist)
0.1.2 (20130102)hoppfrosch (Functions AKK2StandardControlCharacter(), Standard2AHKControlCharacter())
0.1.1 (20121015)hoppfrosch (Memberfunction getJSON())
0.1.0 (20121015)hoppfrosch (Initial)
Summary
Gist-classClass to handle gists (https://gist.github.com/)
Functions
delete
filesReturns an array with filenames stored in gist
getReturns an Object with current GIST
getJSONReturns the JSON string with current GIST
putCreates a new gist
urlReturns the URL of the gist
versionCurrent version of the class (Versioning scheme according to http://semver.org)
__basic_auth_headerCreates authorization token for github (**INTERNAL**)
__extractIDFromURLExtracts ID from a given gist-url(**INTERNAL**)
__HTTPdeleteHTTPdelete on Github-URL (**INTERNAL**)
__HTTPget_objHTTPget on Github-URL, returning result as Object (**INTERNAL**)
__HTTPgetHTTPget on Github-URL, returning result as JSON-String (**INTERNAL**)
__HTTPpostHTTPpost JSON-string to on Github-URL, returning result as JSON-String (**INTERNAL**)
__NewConstructor
AHK2StandardControlCharacterReplace AHK-style control characters to Standard
Standard2AHKControlCharacterReplace Standard control characters to AHK-style

Functions

delete

delete(id = )
Deletes an Gist with given IDif ID is missing the internally stored ID is used

Params

idid of gist to delete (optional - default: internally stored id)

Author(s)

20130102 (Original)hoppfrosch

files

files()

Returns an array with filenames stored in gist

Returns

Array with filenames.  The several files can be accessed via gist.files[fn] with fn as name of the file to access...

Author(s)

20120928 (Original)hoppfrosch

get

get(id = )

Returns an Object with current GIST

Returns

GIST-Object

Author(s)

20120928 (Original)hoppfrosch

getJSON

getJSON(id = )

Returns the JSON string with current GIST

Returns

String (JSON)

Author(s)

20121015 (Original)hoppfrosch

put

put(Contents,  
Title = "AutoHotkey",
Public = "1")

Creates a new gist

Parameters

ContentsContents of the new gist (required)
Titletitle (filename) of the new gist (optional - default: “Autohotkey”)
PublicFlag to indicate wheter new gist should be public (optional - default: 1 (true))

Returns

GIST-Object

Author(s)

20120928 (Original)hoppfrosch

url

url()

Returns the URL of the gist

Returns

String (URL)

Author(s)

20130102 (Original)hoppfrosch

version

version()

Current version of the class (Versioning scheme according to http://semver.org)

Returns

current version number of the class

Author(s)

20120621 (Original)hoppfrosch

__basic_auth_header

__basic_auth_header()

Creates authorization token for github (**INTERNAL**)

Returns

authorization token (string)

Author(s)

20120928 (Original)hoppfrosch 20130102 Support anonymous authorization

__extractIDFromURL

__extractIDFromURL(url)

Extracts ID from a given gist-url(**INTERNAL**)

Parameters

urlgist-URL (required)

Returns

gist-ID

Author(s)

20130102 (Original)hoppfrosch

__HTTPdelete

__HTTPdelete(url)

HTTPdelete on Github-URL (**INTERNAL**)

Parameters

urlURL to delete - it’s a relative URL to “https://api.github.com” (required)

Returns

String (“{“message”:”Not Found”}” in case of Error)

Author(s)

20130102 (Original)hoppfrosch

__HTTPget_obj

__HTTPget_obj(url)

HTTPget on Github-URL, returning result as Object (**INTERNAL**)

Parameters

urlURL to get - it’s a relative URL to “https://api.github.com” (required)

Returns

json object, (empty object in case of error)

Author(s)

20120928 (Original)hoppfrosch

__HTTPget

__HTTPget(url)

HTTPget on Github-URL, returning result as JSON-String (**INTERNAL**)

Parameters

urlURL to get - it’s a relative URL to “https://api.github.com” (required)

Returns

String (“{“message”:”Not Found”}” in case of Error)

Author(s)

20120928 (Original)hoppfrosch

__HTTPpost

__HTTPpost(Contents,  
url =  "/gists")

HTTPpost JSON-string to on Github-URL, returning result as JSON-String (**INTERNAL**)

Parameters

ContentsContents to post
urlURL to get - it’s a relative URL to “https://api.github.com” (required)

Returns

String (“{“message”:”Not Found”}” in case of Error)

Author(s)

20130201 (Original)hoppfrosch

__New

__New(user =  "AHKUser",
password =  "AHKUser2012",
debug =  1)

Constructor

Parameters

userUsername for https://gist.github.com/
passwordPassword for https://gist.github.com/

Author(s)

20120621 (Original)hoppfrosch 20130102 Removed ID as parameter

AHK2StandardControlCharacter

AHK2StandardControlCharacter(J)

Replace AHK-style control characters to Standard

Parameters

JString to convert to Standard style

Returns

String in Standard Style

Author(s)

20130201 (Original)hoppfrosch
Originalgeekdude - http://www.autohotkey.com/board/topic/88675-gist-ahk-l/

Standard2AHKControlCharacter

Standard2AHKControlCharacter(J)

Replace Standard control characters to AHK-style

Parameters

JString to convert to AHK-Style

Returns

String in AHK style

Author(s)

20130201 (Original)hoppfrosch
delete(id = )
files()
Returns an array with filenames stored in gist
get(id = )
Returns an Object with current GIST
getJSON(id = )
Returns the JSON string with current GIST
put(Contents,  
Title = "AutoHotkey",
Public = "1")
Creates a new gist
url()
Returns the URL of the gist
version()
Current version of the class (Versioning scheme according to http://semver.org)
__basic_auth_header()
Creates authorization token for github (**INTERNAL**)
__extractIDFromURL(url)
Extracts ID from a given gist-url(**INTERNAL**)
__HTTPdelete(url)
HTTPdelete on Github-URL (**INTERNAL**)
__HTTPget_obj(url)
HTTPget on Github-URL, returning result as Object (**INTERNAL**)
__HTTPget(url)
HTTPget on Github-URL, returning result as JSON-String (**INTERNAL**)
__HTTPpost(Contents,  
url =  "/gists")
HTTPpost JSON-string to on Github-URL, returning result as JSON-String (**INTERNAL**)
__New(user =  "AHKUser",
password =  "AHKUser2012",
debug =  1)
Constructor
AHK2StandardControlCharacter(J)
Replace AHK-style control characters to Standard
Standard2AHKControlCharacter(J)
Replace Standard control characters to AHK-style
Close