Class: TextAmerica::Client
- Inherits:
-
Object
- Object
- TextAmerica::Client
- Defined in:
- lib/textamerica.rb
Instance Method Summary collapse
-
#bookmarksAssign(moblogid, listid) ⇒ Object
Assigns a bookmark list to a specified moblog.
- #bookmarksDelete(listid) ⇒ Object
-
#bookmarksUnAssign(moblogid, listid) ⇒ Object
Removes a bookmark list from a specified moblog.
-
#bookmarksUpdate(listid, title) ⇒ Object
Updates or creates a new bookmark list.
-
#bookmatksRemoveUrl(listid, url) ⇒ Object
Removes a URL from a specified bookmark list.
-
#bookmatksUpdateUrl(listid, title, url, target) ⇒ Object
Updates or creates a new URL on a specified list.
-
#changeDomain(moblogid, domain) ⇒ Object
Changes an existing moblog domain.
-
#changeSecretWord(moblogid, secretword) ⇒ Object
Changes the secret word of a moblog.
-
#changeText(moblogid, text) ⇒ Object
Updates the description of a moblog.
-
#changeTitle(moblogid, title) ⇒ Object
Updates the title of a moblog.
-
#entryDelete(moblogid, entryid) ⇒ Object
Deletes a specified entry from a moblog.
-
#entryDelete?(moblogid, entryid) ⇒ Boolean
Deletes a specified entry from a moblog.
-
#entryUpdate(moblogid, entryid, title, text, categoryid, imagedata, filetype) ⇒ Object
Updates or creates a new image entry.
-
#entryUpdateEx(moblogid, entryid, title, text, categoryid, file, filetype) ⇒ Object
Updates or creates a new image entry.
-
#favoritesAddMoblog(listid, moblogurl) ⇒ Object
Add a moblog to a Favorites List.
-
#favoritesAssign(moblogid, listid) ⇒ Object
Assigns a Favorites List to be displayed on a moblog.
-
#favoritesDelete(listid, listtitle) ⇒ Object
Remove a moblog to a Favorites List.
-
#favoritesRemoveMoblog(listid, moblogurl) ⇒ Object
Remove a moblog to a Favorites List.
-
#favoritesUpdate(listid, listtitle) ⇒ Object
Returns a list of the owners moblogs.
-
#getCommunityMoblogs(which) ⇒ Object
Returns a list of community moblog.
-
#getMyMoblogs ⇒ Object
Returns a list of the owners moblogs.
-
#initialize(apikey, username, password) ⇒ Client
constructor
A new instance of Client.
-
#keywordsAdd(entryid, keywords) ⇒ Object
Adds keywords to a specified entry / image.
-
#templateSetTemplate(moblogid, graphicid, layoutid) ⇒ Object
Sets a template for a specified moblog from the textamerica template library See http://www.textamerica.com/apicalls.aspx?call=Template.SetTemplate.
-
#templateUpdateSection(moblogid, sectionid, htmlcode) ⇒ Object
Updates the section HTML for a specified moblog.
-
#update(moblogid, domain, secretword, title, text, approvaltype, allowcomments) ⇒ Object
Changes the specific properties of your moblog such as title, text, domain, secret word.
Constructor Details
#initialize(apikey, username, password) ⇒ Client
Returns a new instance of Client.
23 24 25 26 27 28 29 |
# File 'lib/textamerica.rb', line 23 def initialize( apikey, username, password) #@client = XMLRPC::Client.new('xml.api.textamerica.com', '/', 80) @client = XMLRPC::Client.new('localhost', "/",3333) @apikey = apikey @username = username @password = password end |
Instance Method Details
#bookmarksAssign(moblogid, listid) ⇒ Object
Assigns a bookmark list to a specified moblog.
See http://www.textamerica.com/apicalls.aspx?call=Bookmarks.Assign
100 101 102 |
# File 'lib/textamerica.rb', line 100 def bookmarksAssign( moblogid, listid) return @client.call( 'ta.Bookmarks.Assign', @apikey, @username, @password, moblogid, listid) end |
#bookmarksDelete(listid) ⇒ Object
114 115 116 |
# File 'lib/textamerica.rb', line 114 def bookmarksDelete( listid) return @client.call( 'ta.Bookmarks.Delete', @apikey, @username, @password, listid) end |
#bookmarksUnAssign(moblogid, listid) ⇒ Object
Removes a bookmark list from a specified moblog
See http://www.textamerica.com/apicalls.aspx?call=Bookmarks.UnAssign
107 108 109 |
# File 'lib/textamerica.rb', line 107 def bookmarksUnAssign( moblogid, listid) return @client.call( 'ta.Bookmarks.UnAssign', @apikey, @username, @password, moblogid, listid) end |
#bookmarksUpdate(listid, title) ⇒ Object
Updates or creates a new bookmark list. Returns the bookmark list id.
See http://www.textamerica.com/apicalls.aspx?call=Bookmarks.Update
93 94 95 |
# File 'lib/textamerica.rb', line 93 def bookmarksUpdate( listid, title) return @client.call( 'ta.Bookmarks.Update', @apikey, @username, @password, listid, title) end |
#bookmatksRemoveUrl(listid, url) ⇒ Object
Removes a URL from a specified bookmark list.
See http://www.textamerica.com/apicalls.aspx?call=Bookmarks.RemoveURL
128 129 130 |
# File 'lib/textamerica.rb', line 128 def bookmatksRemoveUrl(listid, url) return @client.call( 'ta.Bookmarks.RemoveUrl', @apikey, @username, @password, listid, url) end |
#bookmatksUpdateUrl(listid, title, url, target) ⇒ Object
Updates or creates a new URL on a specified list.
See http://www.textamerica.com/apicalls.aspx?call=Bookmarks.UpdateURL
121 122 123 |
# File 'lib/textamerica.rb', line 121 def bookmatksUpdateUrl(listid, title, url, target) return @client.call( 'ta.Bookmarks.UpdateUrl', @apikey, @username, @password, listid, title, url, target) end |
#changeDomain(moblogid, domain) ⇒ Object
Changes an existing moblog domain. Returns the MoblogID
See http://www.textamerica.com/apicalls.aspx?call=Moblog.ChangeDomain
75 76 77 |
# File 'lib/textamerica.rb', line 75 def changeDomain( moblogid, domain) return @client.call( 'ta.Moblog.ChangeDomain', @apikey, @username, @password, moblogid, domain) end |
#changeSecretWord(moblogid, secretword) ⇒ Object
Changes the secret word of a moblog. Returns the MoblogID
See http://www.textamerica.com/apicalls.aspx?call=Moblog.ChangeSecretWord
82 83 84 |
# File 'lib/textamerica.rb', line 82 def changeSecretWord( moblogid, secretword) return @client.call( 'ta.Moblog.ChangeSecretWord', @apikey, @username, @password, moblogid, secretword) end |
#changeText(moblogid, text) ⇒ Object
Updates the description of a moblog. Returns the MoblogID
See http://www.textamerica.com/apicalls.aspx?call=Moblog.ChangeText
68 69 70 |
# File 'lib/textamerica.rb', line 68 def changeText( moblogid, text) return @client.call( 'ta.Moblog.ChangeText', @apikey, @username, @password, moblogid, text) end |
#changeTitle(moblogid, title) ⇒ Object
Updates the title of a moblog. Returns the MoblogID.
See http://www.textamerica.com/apicalls.aspx?call=Moblog.ChangeTitle
61 62 63 |
# File 'lib/textamerica.rb', line 61 def changeTitle( moblogid, title) return @client.call( 'ta.Moblog.ChangeTitle', @apikey, @username, @password, moblogid, title) end |
#entryDelete(moblogid, entryid) ⇒ Object
Deletes a specified entry from a moblog. Returns "OK".
See http://www.textamerica.com/apicalls.aspx?call=Entry.Delete
228 229 230 |
# File 'lib/textamerica.rb', line 228 def entryDelete( moblogid, entryid) return @client.call( 'ta.Entry.Delete', @apikey, @username, @password, moblogid, entryid) end |
#entryDelete?(moblogid, entryid) ⇒ Boolean
Deletes a specified entry from a moblog. Returns "OK".
See http://www.textamerica.com/apicalls.aspx?call=Entry.Delete
235 236 237 238 |
# File 'lib/textamerica.rb', line 235 def entryDelete?( moblogid, entryid) result = @client.call( 'ta.Entry.Delete', @apikey, @username, @password, moblogid, entryid) return result == 'OK' end |
#entryUpdate(moblogid, entryid, title, text, categoryid, imagedata, filetype) ⇒ Object
Updates or creates a new image entry. Returns the EntryID.
See http://www.textamerica.com/apicalls.aspx?call=Entry.Update
209 210 211 |
# File 'lib/textamerica.rb', line 209 def entryUpdate( moblogid, entryid, title, text, categoryid, imagedata, filetype) return @client.call( 'ta.Entry.Update', @apikey, @username, @password, moblogid, entryid, title, text, categoryid, imagedata, filetype) end |
#entryUpdateEx(moblogid, entryid, title, text, categoryid, file, filetype) ⇒ Object
Updates or creates a new image entry. Returns the EntryID.
See http://www.textamerica.com/apicalls.aspx?call=Entry.Update
216 217 218 219 220 221 222 223 |
# File 'lib/textamerica.rb', line 216 def entryUpdateEx( moblogid, entryid, title, text, categoryid, file, filetype) if File.exists?( file) imagedata = File.open(file, "rb") {|f| f.read} return @client.call( 'ta.Entry.Update', @apikey, @username, @password, moblogid, entryid, title, text, categoryid, XMLRPC::Base64.encode(imagedata), filetype) end end |
#favoritesAddMoblog(listid, moblogurl) ⇒ Object
Add a moblog to a Favorites List
See http://www.textamerica.com/apicalls.aspx?call=Favorites.AddMoblog
161 162 163 |
# File 'lib/textamerica.rb', line 161 def favoritesAddMoblog( listid, moblogurl) return @client.call( 'ta.Favorites.AddMoblog', @apikey, @username, @password, listid, moblogurl) end |
#favoritesAssign(moblogid, listid) ⇒ Object
Assigns a Favorites List to be displayed on a moblog.
See http://www.textamerica.com/apicalls.aspx?call=Favorites.Assign
147 148 149 |
# File 'lib/textamerica.rb', line 147 def favoritesAssign( moblogid, listid) return @client.call( 'ta.Favorites.Assign', @apikey, @username, @password, moblogid, listid) end |
#favoritesDelete(listid, listtitle) ⇒ Object
Remove a moblog to a Favorites List.
See http://www.textamerica.com/apicalls.aspx?call=Favorites.Delete
154 155 156 |
# File 'lib/textamerica.rb', line 154 def favoritesDelete( listid, listtitle) return @client.call( 'ta.Favorites.Delete', @apikey, @username, @password, listid, listtitle) end |
#favoritesRemoveMoblog(listid, moblogurl) ⇒ Object
Remove a moblog to a Favorites List.
See http://www.textamerica.com/apicalls.aspx?call=Favorites.RemoveMoblog
168 169 170 |
# File 'lib/textamerica.rb', line 168 def favoritesRemoveMoblog( listid, moblogurl) return @client.call( 'ta.Favorites.RemoveMoblog', @apikey, @username, @password, listid, moblogurl) end |
#favoritesUpdate(listid, listtitle) ⇒ Object
Returns a list of the owners moblogs.
See http://www.textamerica.com/apicalls.aspx?call=Favorites.Update
140 141 142 |
# File 'lib/textamerica.rb', line 140 def favoritesUpdate( listid, listtitle) return @client.call( 'ta.Favorites.Update', @apikey, @username, @password, listid, listtitle) end |
#getCommunityMoblogs(which) ⇒ Object
Returns a list of community moblog
See http://www.textamerica.com/apicalls.aspx?call=Moblog.GetCommunityMoblogs
46 47 48 |
# File 'lib/textamerica.rb', line 46 def getCommunityMoblogs( which ) return @client.call( 'ta.Moblog.GetCommunityMoblogs', @apikey, @username, @password, which) end |
#getMyMoblogs ⇒ Object
Returns a list of the owners moblogs
See http://www.textamerica.com/apicalls.aspx?call=Moblog.GetMyMoblogs
39 40 41 |
# File 'lib/textamerica.rb', line 39 def getMyMoblogs return @client.call( 'ta.Moblog.GetMyMoblogs', @apikey, @username, @password ) end |
#keywordsAdd(entryid, keywords) ⇒ Object
Adds keywords to a specified entry / image
See http://www.textamerica.com/apicalls.aspx?call=Keywords.Add
198 199 200 |
# File 'lib/textamerica.rb', line 198 def keywordsAdd(entryid, keywords) return @client.call( 'ta.Keywords.Add', @apikey, @username, @password, entryid, keywords) end |
#templateSetTemplate(moblogid, graphicid, layoutid) ⇒ Object
Sets a template for a specified moblog from the textamerica template library
See http://www.textamerica.com/apicalls.aspx?call=Template.SetTemplate
186 187 188 |
# File 'lib/textamerica.rb', line 186 def templateSetTemplate(moblogid, graphicid, layoutid) return @client.call( 'ta.Template.SetTemplate', @apikey, @username, @password, moblogid, graphicid, layoutid) end |
#templateUpdateSection(moblogid, sectionid, htmlcode) ⇒ Object
Updates the section HTML for a specified moblog
See http://www.textamerica.com/apicalls.aspx?call=Template.UpdateSection
179 180 181 |
# File 'lib/textamerica.rb', line 179 def templateUpdateSection(moblogid, sectionid, htmlcode) return @client.call( 'ta.Template.UpdateSection', @apikey, @username, @password, moblogid, sectionid, htmlcode) end |
#update(moblogid, domain, secretword, title, text, approvaltype, allowcomments) ⇒ Object
Changes the specific properties of your moblog such as title, text, domain, secret word. Returns a MoblogID
See http://www.textamerica.com/apicalls.aspx?call=Moblog.Update
53 54 55 56 |
# File 'lib/textamerica.rb', line 53 def update( moblogid, domain, secretword, title, text, approvaltype, allowcomments ) return @client.call( 'ta.Moblog.Update', @apikey, @username, @password, moblogid, domain, secretword, title, text, approvaltype, allowcomments) end |