﻿/*
* mrshaunwilson.twitter.js
* Copyright (c) Shaun Wilson
*/
if (mrshaunwilson !== undefined) {
    if (mrshaunwilson.social !== undefined) {
        mrshaunwilson.social.twitter = {
            loadFrom: function (options) {
                var context = this;
                $.ajax({
                    dataType: 'json',
                    contentType: 'application/json',
                    type: 'GET',
                    url: options.url,
                    success: function (response, status, xhr) {
                        var json = response[0];
                        $.observable(context)
                            .setProperty(json);
                        if (options.completed) {
                            options.completed(json);
                        }
                    },
                    error: function (xhr, status, error) {
                        console.log(status);
                        console.log(error);
                    }
                });
            }
        };
    }
}

