Class: Attune::Api::Entities
- Inherits:
-
Object
- Object
- Attune::Api::Entities
- Defined in:
- lib/attune/api/entities.rb
Instance Method Summary collapse
-
#batch_get_rankings(body) ⇒ Attune::Model::BatchRankingResult
Returns multiple rankings of the specified entities for the current user.
-
#blacklist_delete(id) ⇒ Attune::Model::BlacklistDeleteResponse
Delete blacklist by id.
-
#blacklist_get(id) ⇒ Attune::Model::Blacklist
Returns the blacklist with the specified ID.
-
#blacklist_get_all ⇒ Attune::Model::BlacklistGetResponse
List all blacklist entries for your account.
-
#blacklist_save(body) ⇒ Attune::Model::BlacklistSaveResponse
Save a new blacklist entry.
-
#blacklist_update(id, body) ⇒ Attune::Model::BlacklistUpdateResponse
Updates a blacklist with the specified ID.
-
#get_rankings(body) ⇒ Attune::Model::RankedEntities
Returns a ranking of the specified entities for the current user.
-
#initialize(client) ⇒ Entities
constructor
A new instance of Entities.
Constructor Details
#initialize(client) ⇒ Entities
Returns a new instance of Entities.
9 10 11 |
# File 'lib/attune/api/entities.rb', line 9 def initialize(client) @client = client end |
Instance Method Details
#batch_get_rankings(body) ⇒ Attune::Model::BatchRankingResult
Returns multiple rankings of the specified entities for the current user.
326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
# File 'lib/attune/api/entities.rb', line 326 def batch_get_rankings (body) query_param_keys = [] # verify existence of params raise ArgumentError, "body is required" if body.nil? # set default values and merge with input = { :body => body} #resource path path = "/entities/ranking/many".sub('{format}','json') # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil if body != nil if body.is_a?(Array) array = Array.new body.each do |item| if item.respond_to?("to_body".to_sym) array.push item.to_body else array.push item end end post_body = array else if body.respond_to?("to_body".to_sym) post_body = body.to_body else post_body = body end end end response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::BatchRankingResult.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.batch_get_rankings'] if mockProc mockResponse = mockProc.call(body) Attune::Model::BatchRankingResult.new(mockResponse) else nil end end end |
#blacklist_delete(id) ⇒ Attune::Model::BlacklistDeleteResponse
Delete blacklist by id.
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/attune/api/entities.rb', line 181 def blacklist_delete (id) query_param_keys = [] # verify existence of params raise ArgumentError, "id is required" if id.nil? # set default values and merge with input = { :id => id} #resource path path = "/entities/rankings/blacklists/{id}".sub('{format}','json').sub('{' + 'id' + '}', escapeString(id)) # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil response = @client.request(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::BlacklistDeleteResponse.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.blacklist_delete'] if mockProc mockResponse = mockProc.call(id) Attune::Model::BlacklistDeleteResponse.new(mockResponse) else nil end end end |
#blacklist_get(id) ⇒ Attune::Model::Blacklist
Returns the blacklist with the specified ID.
223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 |
# File 'lib/attune/api/entities.rb', line 223 def blacklist_get (id) query_param_keys = [] # verify existence of params raise ArgumentError, "id is required" if id.nil? # set default values and merge with input = { :id => id} #resource path path = "/entities/rankings/blacklists/{id}".sub('{format}','json').sub('{' + 'id' + '}', escapeString(id)) # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil response = @client.request(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::Blacklist.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.blacklist_get'] if mockProc mockResponse = mockProc.call(id) Attune::Model::Blacklist.new(mockResponse) else nil end end end |
#blacklist_get_all ⇒ Attune::Model::BlacklistGetResponse
List all blacklist entries for your account.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/attune/api/entities.rb', line 78 def blacklist_get_all () query_param_keys = [] # set default values and merge with input = { } #resource path path = "/entities/rankings/blacklists".sub('{format}','json') # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil response = @client.request(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::BlacklistGetResponse.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.blacklist_get_all'] if mockProc mockResponse = mockProc.call() Attune::Model::BlacklistGetResponse.new(mockResponse) else nil end end end |
#blacklist_save(body) ⇒ Attune::Model::BlacklistSaveResponse
Save a new blacklist entry.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/attune/api/entities.rb', line 20 def blacklist_save (body) query_param_keys = [] # set default values and merge with input = { :body => body} #resource path path = "/entities/rankings/blacklists".sub('{format}','json') # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil if body != nil if body.is_a?(Array) array = Array.new body.each do |item| if item.respond_to?("to_body".to_sym) array.push item.to_body else array.push item end end post_body = array else if body.respond_to?("to_body".to_sym) post_body = body.to_body else post_body = body end end end response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::BlacklistSaveResponse.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.blacklist_save'] if mockProc mockResponse = mockProc.call(body) Attune::Model::BlacklistSaveResponse.new(mockResponse) else nil end end end |
#blacklist_update(id, body) ⇒ Attune::Model::BlacklistUpdateResponse
Updates a blacklist with the specified ID.
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/attune/api/entities.rb', line 118 def blacklist_update (id,body) query_param_keys = [] # verify existence of params raise ArgumentError, "id is required" if id.nil? # set default values and merge with input = { :id => id, :body => body} #resource path path = "/entities/rankings/blacklists/{id}".sub('{format}','json').sub('{' + 'id' + '}', escapeString(id)) # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil if body != nil if body.is_a?(Array) array = Array.new body.each do |item| if item.respond_to?("to_body".to_sym) array.push item.to_body else array.push item end end post_body = array else if body.respond_to?("to_body".to_sym) post_body = body.to_body else post_body = body end end end response = @client.request(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::BlacklistUpdateResponse.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.blacklist_update'] if mockProc mockResponse = mockProc.call(id,body) Attune::Model::BlacklistUpdateResponse.new(mockResponse) else nil end end end |
#get_rankings(body) ⇒ Attune::Model::RankedEntities
Returns a ranking of the specified entities for the current user.
265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
# File 'lib/attune/api/entities.rb', line 265 def get_rankings (body) query_param_keys = [] # verify existence of params raise ArgumentError, "body is required" if body.nil? # set default values and merge with input = { :body => body} #resource path path = "/entities/ranking".sub('{format}','json') # pull querystring keys from options queryopts = .select do |key,value| query_param_keys.include? key end headers = nil post_body = nil if body != nil if body.is_a?(Array) array = Array.new body.each do |item| if item.respond_to?("to_body".to_sym) array.push item.to_body else array.push item end end post_body = array else if body.respond_to?("to_body".to_sym) post_body = body.to_body else post_body = body end end end response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body }) if response Attune::Model::RankedEntities.new(JSON.parse(response.body)) else mockProc = MOCKS['Entities.get_rankings'] if mockProc mockResponse = mockProc.call(body) Attune::Model::RankedEntities.new(mockResponse) else nil end end end |