Skip to content

Commit

Permalink
Merge pull request #50 from brianjmiller/master
Browse files Browse the repository at this point in the history
Sprint of fixes and enhancements
  • Loading branch information
bscSCORM committed Aug 19, 2013
2 parents 9af2dc3 + 1cf874a commit c29a1ac
Show file tree
Hide file tree
Showing 22 changed files with 2,270 additions and 160 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,4 @@ Alternatively you can just link to the individual files themselves like so:
<script type="text/javascript" src="src/StatementsResult.js"></script>
<script type="text/javascript" src="src/State.js"></script>
<script type="text/javascript" src="src/ActivityProfile.js"></script>
<script type="text/javascript" src="src/AgentProfile.js"></script>
1 change: 1 addition & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ new gear.Queue(
,'src/StatementsResult.js'
,'src/State.js'
,'src/ActivityProfile.js'
,'src/AgentProfile.js'
]
)
.log("Linting")
Expand Down
2 changes: 1 addition & 1 deletion build/tincan-min.js

Large diffs are not rendered by default.

797 changes: 745 additions & 52 deletions build/tincan.js

Large diffs are not rendered by default.

9 changes: 8 additions & 1 deletion src/ActivityProfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ TinCan client library
*/
this.etag = null;

/**
@property contentType
@type String
*/
this.contentType = null;

this.init(cfg);
};
ActivityProfile.prototype = {
Expand All @@ -86,7 +92,8 @@ TinCan client library
directProps = [
"id",
"contents",
"etag"
"etag",
"contentType"
],
val
;
Expand Down
133 changes: 133 additions & 0 deletions src/AgentProfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/*
Copyright 2013 Rustici Software
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

/**
TinCan client library
@module TinCan
@submodule TinCan.AgentProfile
**/
(function () {
"use strict";

/**
@class TinCan.AgentProfile
@constructor
*/
var AgentProfile = TinCan.AgentProfile = function (cfg) {
this.log("constructor");

/**
@property id
@type String
*/
this.id = null;

/**
@property agent
@type TinCan.Agent
*/
this.agent = null;

/**
@property updated
@type String
*/
this.updated = null;

/**
@property contents
@type String
*/
this.contents = null;

/**
SHA1 of contents as provided by the server during last fetch,
this should be passed through to saveAgentProfile
@property etag
@type String
*/
this.etag = null;

/**
@property contentType
@type String
*/
this.contentType = null;

this.init(cfg);
};
AgentProfile.prototype = {
/**
@property LOG_SRC
*/
LOG_SRC: 'AgentProfile',

/**
@method log
*/
log: TinCan.prototype.log,

/**
@method init
@param {Object} [options] Configuration used to initialize
*/
init: function (cfg) {
this.log("init");
var i,
directProps = [
"id",
"contents",
"etag",
"contentType"
],
val
;

cfg = cfg || {};

if (cfg.hasOwnProperty("agent")) {
if (cfg.agent instanceof TinCan.Agent) {
this.agent = cfg.agent;
}
else {
this.agent = new TinCan.Agent (cfg.agent);
}
}

for (i = 0; i < directProps.length; i += 1) {
if (cfg.hasOwnProperty(directProps[i]) && cfg[directProps[i]] !== null) {
this[directProps[i]] = cfg[directProps[i]];
}
}

this.updated = false;
}
};

/**
@method fromJSON
@return {Object} AgentProfile
@static
*/
AgentProfile.fromJSON = function (stateJSON) {
AgentProfile.prototype.log("fromJSON");
var _state = JSON.parse(stateJSON);

return new AgentProfile(_state);
};
}());
Loading

0 comments on commit c29a1ac

Please sign in to comment.