1 | var util = require("util");
|
2 | var BaseClient = require("./client");
|
3 | var extend = require("./extend");
|
4 |
|
5 | function ScreenshotClient(settings) {
|
6 | this.server = {
|
7 | host: "www.browserstack.com"
|
8 | };
|
9 | BaseClient.call(this, settings);
|
10 | }
|
11 |
|
12 | util.inherits(ScreenshotClient, BaseClient);
|
13 |
|
14 |
|
15 | extend(ScreenshotClient.prototype, {
|
16 | getBrowsers: function(fn) {
|
17 | this.request({
|
18 | path: this.path("/browsers.json")
|
19 | }, fn);
|
20 | },
|
21 |
|
22 | generateScreenshots: function(options, fn) {
|
23 | var data = JSON.stringify(options);
|
24 | this.request({
|
25 | method: "POST",
|
26 | path: this.path("")
|
27 | }, data, fn);
|
28 | },
|
29 |
|
30 | getJob: function(id, fn) {
|
31 | this.request({
|
32 | path: this.path("/" + id + ".json")
|
33 | }, fn);
|
34 | }
|
35 | });
|
36 |
|
37 |
|
38 | extend(ScreenshotClient.prototype, {
|
39 | path: function(path) {
|
40 | return "/screenshots" + path;
|
41 | }
|
42 | });
|
43 |
|
44 | module.exports = {
|
45 | createClient: function(settings) {
|
46 | return new ScreenshotClient(settings);
|
47 | }
|
48 | };
|