Skip to content

yigitozkavci/hurriyet-ruby

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

hurriyet-ruby

Gem Version Test Coverage Travis CI

Unofficial Ruby Wrapper for Hurriyet API - http://developers.hurriyet.com.tr/

Getting Started

Installation

$ gem install hurriyet

Usage

require 'hurriyet'

client = Hurriyet::Client.new(<YOUR_API_KEY>)
client.articles.all

Table of Contents

Resources

Other

Resources

Articles

# Get all articles
client.articles.all
# Get a single article
client.articles.single(40220736)

Columns

# Get all columns
client.columns.all
# Get a single column
client.columns.single(40220397)

News Photo Galleries

# Get all galleries
client.news_photo_galleries.all
# Get a single gallery
client.news_photo_galleries.single(40220735)

Pages

# Get all pages
client.pages.all
# Get a single page
client.pages.single('55e861bc6534652c108afa2f')

Paths

# Get all paths
client.paths.all
# Get a single path
client.paths.single('563cddcc67b0a934e44ee2d7')

Writers

# Get all writers
client.writers.all
# Get a single writer
client.writers.single('570167e867b0a90bdc503452')

Parameters

Hurriyet API allows you to filter, select and limit the resources you fetch. Here is how:

  • $select: Select only 1 column from incoming resources.
  • $top: Limit response resources.
  • $filter: Filter incoming resources. See here for more info.
# Takes 3 articles.
client.articles.all top: 3

# Takes 3 articles of which path equals to 'gundem'
client.articles.all top: 4, filter: 'Path eq \'gundem\''

# Selects title of articles of which title contains word 'Istanbul'
client.articles.all filter: 'contains(Title, \'Istanbul\')', select: 'Title'

LICENSE

This project is licensed under the terms of the MIT license.