Skip to content

Commit

Permalink
Launch tweeks
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Aug 6, 2014
1 parent 3bb6697 commit 630126f
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
language: node_js
node_js:
- "0.10"
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,9 @@ query.type([itc.type.inapp, itc.type.app]);

# itcreport

*Command-Line tool to get report results from console. It can output result to console or to to json file*
*Command-Line tool to get report results from console. It can output result to console or to to json file.*

**I strongly recommend to put username and password in config file so its not in bash history**

```
$ itcreport --help
Expand Down Expand Up @@ -492,6 +494,58 @@ $ itcreport --help
-o, --outputfile <filename> Output file name. Will be saved as json.
```

**Some examples ...**

```
$ itcreport create-config sample.json
```

```
$ itcreport timed -c sample.json --since 1week
```

```
$ itcreport timed -c sample.json --since 1week -C 6001 -C 6002
```

```
$ itcreport timed -c sample.json --date 2014-01-01
```

### itcreport strings
*Same story as for [constants](#constants)*

```js
// Types
inapp
app

// Transactions
free
paid
redownload
update
refund

// Platforms
desktop
iphone
ipad
ipod

// Measures
proceeds
units
```

```
$ itcreport timed -c sample.json --date 2014-01-01 --platform desktop --platform ipad
```

# TODO

- Better tests
- More examples

# Links

Expand Down
21 changes: 20 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ exports.measure = {
* @param {Number} [options.concurrentRequests] Number of concurrent requests
* @param {Array} [options.cookies] Cookies array. If you provide cookies array it will not login and use this instead.
* @param {Function} [options.errorCallback] Error callback function called when requests are failing
* @param {Function} [options.errorCallback.error] Login error
* @param {Function} [options.loginCallback] Login callback function called when login to iTunes Connect was a success.
* @param {Function} [options.loginCallback.cookies] cookies are passed as a first argument. You can get it and cache it for later.
*/
Expand Down Expand Up @@ -698,6 +699,9 @@ Query.prototype.content = function(value) {
if(typeof this.config.filters["content"] === "undefined")
this.config.filters.content = [];

if(!_.isArray(this.config.filters.content))
this.config.filters.content = [this.config.filters.content];

if(_.isArray(value))
this.config.filters.content = this.config.filters.content.concat(value);
else
Expand Down Expand Up @@ -739,6 +743,9 @@ Query.prototype.category = function(value) {
if(typeof this.config.filters["category"] === "undefined")
this.config.filters.category = [];

if(!_.isArray(this.config.filters.category))
this.config.filters.category = [this.config.filters.category];

if(_.isArray(value))
this.config.filters.category = this.config.filters.category.concat(value);
else
Expand All @@ -760,6 +767,9 @@ Query.prototype.location = function(value) {
if(typeof this.config.filters["location"] === "undefined")
this.config.filters.location = [];

if(!_.isArray(this.config.filters.location))
this.config.filters.location = [this.config.filters.location];

if(_.isArray(value))
this.config.filters.location = this.config.filters.location.concat(value);
else
Expand All @@ -781,6 +791,9 @@ Query.prototype.platform = function(value) {
if(typeof this.config.filters["platform"] === "undefined")
this.config.filters.platform = [];

if(!_.isArray(this.config.filters.platform))
this.config.filters.platform = [this.config.filters.platform];

if(_.isArray(value))
this.config.filters.platform = this.config.filters.platform.concat(value);
else
Expand All @@ -802,6 +815,9 @@ Query.prototype.type = function(value) {
if(typeof this.config.filters["type"] === "undefined")
this.config.filters.type = [];

if(!_.isArray(this.config.filters.type))
this.config.filters.type = [this.config.filters.type];

if(_.isArray(value))
this.config.filters.type = this.config.filters.type.concat(value);
else
Expand All @@ -820,9 +836,12 @@ Query.prototype.type = function(value) {
*/

Query.prototype.transaction = function(value) {
if(typeof this.config.filters["transaction"] === "undefined")
if(typeof this.config.filters["transaction"] === "undefined")
this.config.filters.transaction = [];

if(!_.isArray(this.config.filters.transaction))
this.config.filters.transaction = [this.config.filters.transaction];

if(_.isArray(value))
this.config.filters.transaction = this.config.filters.transaction.concat(value);
else
Expand Down
26 changes: 21 additions & 5 deletions test/Report.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ describe('Report', function(){
filters : {
content: [1,2,3],
location: [4,5,6],
transaction: itc.Transaction.Free,
transaction: itc.transaction.free,
type: [
itc.Type.InApp,
itc.Type.App
itc.type.inapp,
itc.type.app
],
category: 7
}
Expand All @@ -122,17 +122,33 @@ describe('Report', function(){
"option_keys": [4, 5, 6]
}, {
"dimension_key": "transaction_type",
"option_keys": [itc.Transaction.Free]
"option_keys": [itc.transaction.free]
}, {
"dimension_key": "content_type",
"option_keys": [itc.Type.InApp, itc.Type.App]
"option_keys": [itc.type.inapp, itc.type.app]
}, {
"dimension_key": "Category",
"option_keys": [7]
}]
});
done();
})
it('should have correct filters property when using query and chainable method', function(done) {
var query = Report.ranked({
filters : {
category: 7
}
}).category(8).category([9, 10]);
query.body();

query._body.should.have.properties({
"filters": [{
"dimension_key": "Category",
"option_keys": [7,8,9,10]
}]
});
done();
})
})
})

Expand Down

0 comments on commit 630126f

Please sign in to comment.