// hurriyet.js
var request = require('request');

var Hurriyet = function (apikey) {
  this.apikey = apikey;
  this.options = {
    url: 'https://api.hurriyet.com.tr/v1/',
    headers: {
      'accept': 'application/json',
      'apikey': apikey
    }
  }
};

Hurriyet.prototype = {
  Articles : function Articles(){console.log('articles');},
  Columns  : function Columns(){},
  Date  : function Date(){/*sadece date dondurecek*/},
  NewsPhotoGallery : function NewsPhotoGallery(){},
  Page : function Page(){},
  Path : function Path(){}
}


Hurriyet.prototype.Articles = {
  getAll : function(){
    console.log('getAllArticles');
  }
};

Hurriyet.prototype.info = function () {
  console.log('Hurriyet !');
  console.log(this.apikey);
  console.log(this.options);
  console.log('----');
}

Hurriyet.prototype.articles = function(){
  var options = {
    url: 'https://api.hurriyet.com.tr/v1/articles/40199',
    headers: {
      'accept': 'application/json',
      'apikey': this.apikey
    }
  };
  function callback(error, response, body) {
    if (!error && response.statusCode == 200) {
      console.log('geldi');
      console.log(body);
      //var info = JSON.parse(body);
      //console.log(info);
    }
  }
  request(options, callback);
}


module.exports = Hurriyet;
