Class: StreamClient
- Inherits:
-
Object
- Object
- StreamClient
- Defined in:
- lib/omnifocus/attask.rb
Constant Summary collapse
- PATH_LOGIN =
"/login"
- PATH_LOGOUT =
"/logout"
- PATH_SEARCH =
"/search"
Instance Method Summary collapse
-
#delete(objCode, objID, force = false) ⇒ Object
delete.
-
#get(objCode, objID, fields = nil) ⇒ Object
retrieve.
- #getList(objCode, ids, fields = nil) ⇒ Object
-
#initialize(apiURL) ⇒ StreamClient
constructor
A new instance of StreamClient.
- #login(username, password) ⇒ Object
- #logout ⇒ Object
-
#post(objCode, message, fields = nil) ⇒ Object
create.
-
#put(objCode, objID, message, fields = nil) ⇒ Object
update.
- #search(objCode, query, fields = nil) ⇒ Object
- #userID ⇒ Object
Constructor Details
#initialize(apiURL) ⇒ StreamClient
Returns a new instance of StreamClient.
128 129 130 131 132 |
# File 'lib/omnifocus/attask.rb', line 128 def initialize(apiURL) @apiURL = apiURL @sessionID = nil @userID = nil; end |
Instance Method Details
#delete(objCode, objID, force = false) ⇒ Object
delete
175 176 177 |
# File 'lib/omnifocus/attask.rb', line 175 def delete(objCode, objID, force=false) request("/#{objCode}/#{objID}", {'force' => force}, nil, "DELETE") end |
#get(objCode, objID, fields = nil) ⇒ Object
retrieve
170 171 172 |
# File 'lib/omnifocus/attask.rb', line 170 def get(objCode, objID, fields=nil) request("/#{objCode}/#{objID}", nil, fields, "GET") end |
#getList(objCode, ids, fields = nil) ⇒ Object
155 156 157 |
# File 'lib/omnifocus/attask.rb', line 155 def getList(objCode, ids, fields=nil) request("/#{objCode}", {'id' => ids.join(',')}, fields, "GET") end |
#login(username, password) ⇒ Object
138 139 140 141 142 143 |
# File 'lib/omnifocus/attask.rb', line 138 def login(username, password) data = request(PATH_LOGIN, {'username' => username, 'password' => password}, nil, "GET") @sessionID = data['sessionID'] @userID = data['userID'] end |
#logout ⇒ Object
145 146 147 148 149 |
# File 'lib/omnifocus/attask.rb', line 145 def logout request(PATH_LOGOUT, {'sessionID' => @sessionID}, nil, "GET") @sessionID = nil @userID = nil end |
#post(objCode, message, fields = nil) ⇒ Object
create
160 161 162 |
# File 'lib/omnifocus/attask.rb', line 160 def post(objCode, , fields=nil) request("/#{objCode}", , fields, "POST") end |
#put(objCode, objID, message, fields = nil) ⇒ Object
update
165 166 167 |
# File 'lib/omnifocus/attask.rb', line 165 def put(objCode, objID, , fields=nil) request("/#{objCode}/#{objID}", , fields, "PUT") end |
#search(objCode, query, fields = nil) ⇒ Object
151 152 153 |
# File 'lib/omnifocus/attask.rb', line 151 def search(objCode, query, fields=nil) request("/#{objCode}#{PATH_SEARCH}", query, fields, "GET") end |
#userID ⇒ Object
134 135 136 |
# File 'lib/omnifocus/attask.rb', line 134 def userID @userID end |