Skip to content

Commit c29a1ac

Browse files
committed
Merge pull request #50 from brianjmiller/master
Sprint of fixes and enhancements
2 parents 9af2dc3 + 1cf874a commit c29a1ac

22 files changed

+2270
-160
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,4 @@ Alternatively you can just link to the individual files themselves like so:
4141
<script type="text/javascript" src="src/StatementsResult.js"></script>
4242
<script type="text/javascript" src="src/State.js"></script>
4343
<script type="text/javascript" src="src/ActivityProfile.js"></script>
44+
<script type="text/javascript" src="src/AgentProfile.js"></script>

build.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ new gear.Queue(
3434
,'src/StatementsResult.js'
3535
,'src/State.js'
3636
,'src/ActivityProfile.js'
37+
,'src/AgentProfile.js'
3738
]
3839
)
3940
.log("Linting")

build/tincan-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/tincan.js

Lines changed: 745 additions & 52 deletions
Large diffs are not rendered by default.

src/ActivityProfile.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ TinCan client library
6363
*/
6464
this.etag = null;
6565

66+
/**
67+
@property contentType
68+
@type String
69+
*/
70+
this.contentType = null;
71+
6672
this.init(cfg);
6773
};
6874
ActivityProfile.prototype = {
@@ -86,7 +92,8 @@ TinCan client library
8692
directProps = [
8793
"id",
8894
"contents",
89-
"etag"
95+
"etag",
96+
"contentType"
9097
],
9198
val
9299
;

src/AgentProfile.js

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
/*
2+
Copyright 2013 Rustici Software
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
/**
18+
TinCan client library
19+
20+
@module TinCan
21+
@submodule TinCan.AgentProfile
22+
**/
23+
(function () {
24+
"use strict";
25+
26+
/**
27+
@class TinCan.AgentProfile
28+
@constructor
29+
*/
30+
var AgentProfile = TinCan.AgentProfile = function (cfg) {
31+
this.log("constructor");
32+
33+
/**
34+
@property id
35+
@type String
36+
*/
37+
this.id = null;
38+
39+
/**
40+
@property agent
41+
@type TinCan.Agent
42+
*/
43+
this.agent = null;
44+
45+
/**
46+
@property updated
47+
@type String
48+
*/
49+
this.updated = null;
50+
51+
/**
52+
@property contents
53+
@type String
54+
*/
55+
this.contents = null;
56+
57+
/**
58+
SHA1 of contents as provided by the server during last fetch,
59+
this should be passed through to saveAgentProfile
60+
61+
@property etag
62+
@type String
63+
*/
64+
this.etag = null;
65+
66+
/**
67+
@property contentType
68+
@type String
69+
*/
70+
this.contentType = null;
71+
72+
this.init(cfg);
73+
};
74+
AgentProfile.prototype = {
75+
/**
76+
@property LOG_SRC
77+
*/
78+
LOG_SRC: 'AgentProfile',
79+
80+
/**
81+
@method log
82+
*/
83+
log: TinCan.prototype.log,
84+
85+
/**
86+
@method init
87+
@param {Object} [options] Configuration used to initialize
88+
*/
89+
init: function (cfg) {
90+
this.log("init");
91+
var i,
92+
directProps = [
93+
"id",
94+
"contents",
95+
"etag",
96+
"contentType"
97+
],
98+
val
99+
;
100+
101+
cfg = cfg || {};
102+
103+
if (cfg.hasOwnProperty("agent")) {
104+
if (cfg.agent instanceof TinCan.Agent) {
105+
this.agent = cfg.agent;
106+
}
107+
else {
108+
this.agent = new TinCan.Agent (cfg.agent);
109+
}
110+
}
111+
112+
for (i = 0; i < directProps.length; i += 1) {
113+
if (cfg.hasOwnProperty(directProps[i]) && cfg[directProps[i]] !== null) {
114+
this[directProps[i]] = cfg[directProps[i]];
115+
}
116+
}
117+
118+
this.updated = false;
119+
}
120+
};
121+
122+
/**
123+
@method fromJSON
124+
@return {Object} AgentProfile
125+
@static
126+
*/
127+
AgentProfile.fromJSON = function (stateJSON) {
128+
AgentProfile.prototype.log("fromJSON");
129+
var _state = JSON.parse(stateJSON);
130+
131+
return new AgentProfile(_state);
132+
};
133+
}());

0 commit comments

Comments
 (0)