wykop 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +6 -0
- data/.travis.yml +5 -0
- data/Contributors.md +0 -0
- data/Gemfile +8 -0
- data/README.md +52 -0
- data/Rakefile +8 -0
- data/TODO.md +7 -0
- data/doc/diggs/add.md +7 -0
- data/doc/diggs/favorites.md +17 -0
- data/doc/diggs/links.md +14 -0
- data/doc/diggs/observatory.md +15 -0
- data/doc/diggs/popular.md +14 -0
- data/doc/diggs/related.md +20 -0
- data/doc/diggs/stream.md +25 -0
- data/doc/diggs/tag.md +41 -0
- data/doc/diggs/tags.md +11 -0
- data/doc/diggs/top.md +44 -0
- data/doc/index.md +18 -0
- data/doc/search.md +44 -0
- data/doc/user/basic.md +81 -0
- data/doc/user/link.md +14 -0
- data/doc/user/pm.md +13 -0
- data/doc/user/rank.md +12 -0
- data/lib/wykop.rb +8 -0
- data/lib/wykop/client.rb +77 -0
- data/lib/wykop/configuration.rb +29 -0
- data/lib/wykop/error.rb +14 -0
- data/lib/wykop/operations/add.rb +22 -0
- data/lib/wykop/operations/favorites.rb +27 -0
- data/lib/wykop/operations/link.rb +55 -0
- data/lib/wykop/operations/links.rb +18 -0
- data/lib/wykop/operations/message.rb +30 -0
- data/lib/wykop/operations/observatory.rb +35 -0
- data/lib/wykop/operations/popular.rb +18 -0
- data/lib/wykop/operations/rank.rb +23 -0
- data/lib/wykop/operations/related.rb +24 -0
- data/lib/wykop/operations/request.rb +39 -0
- data/lib/wykop/operations/search.rb +42 -0
- data/lib/wykop/operations/stream.rb +26 -0
- data/lib/wykop/operations/tag.rb +33 -0
- data/lib/wykop/operations/tags.rb +17 -0
- data/lib/wykop/operations/top.rb +52 -0
- data/lib/wykop/operations/user.rb +55 -0
- data/lib/wykop/version.rb +3 -0
- data/spec/spec_helper.rb +16 -0
- data/spec/user_spec.rb +70 -0
- data/wykop.gemspec +26 -0
- metadata +141 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: ef857b8dc4ef8b2257e4046344fd762a49a90908
|
4
|
+
data.tar.gz: d009a48c9e3f1616556cf7f80c6a063c1b85f765
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 60a6cf6fe39f8b6a2dda736fe6aa7a0b9db803be856faff1abae2229eb6ac69c58bc5a59eddc298e43beb3d3a60ed79e8b618c0c93127282c2317563881dee91
|
7
|
+
data.tar.gz: 87582eacb622ed29c125b989470cf7c7c012064865485d6a9e3b4eb6212a9d12346297dae5d8f70aaf007af783ee9e34a9a4bd06c80fd8518b55a2ff086e0b42
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Contributors.md
ADDED
File without changes
|
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
# Gem for wykop.pl API
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/wykop.svg)](http://badge.fury.io/rb/wykop)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/lukaszraczylo/wykop-ruby/badges/gpa.svg)](https://codeclimate.com/github/lukaszraczylo/wykop-ruby)
|
5
|
+
[![Build Status](https://travis-ci.org/lukaszraczylo/wykop-ruby.svg?branch=master)](https://travis-ci.org/lukaszraczylo/wykop-ruby)
|
6
|
+
[![Gratipay](https://img.shields.io/gratipay/lukaszraczylo.svg)](https://gratipay.com/lukaszraczylo/)
|
7
|
+
|
8
|
+
This is a Ruby Gem for the Wykop.pl API. It should simplify the process of consuming data from the Wykop.pl API for developers using Ruby.
|
9
|
+
|
10
|
+
|
11
|
+
### Heads up
|
12
|
+
|
13
|
+
Until version 0.9+ gem will and should be considered as 'under heavy development'. Please be aware and don't bitch too much.
|
14
|
+
Current gem version: [![Gem Version](https://badge.fury.io/rb/wykop.svg)](http://badge.fury.io/rb/wykop)
|
15
|
+
|
16
|
+
If you'd like to contribute - I'm really happy with your pull requests so feel free!
|
17
|
+
|
18
|
+
### Installation
|
19
|
+
Add following to your application Gemfile:
|
20
|
+
|
21
|
+
```
|
22
|
+
gem 'wykop', require: 'wykop'
|
23
|
+
```
|
24
|
+
|
25
|
+
And then execute:
|
26
|
+
|
27
|
+
```
|
28
|
+
$ bundle
|
29
|
+
```
|
30
|
+
|
31
|
+
Or install it on your own:
|
32
|
+
|
33
|
+
```
|
34
|
+
$ gem install wykop
|
35
|
+
```
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
### Documentation
|
40
|
+
|
41
|
+
* [Read the f** doc](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/index.md)
|
42
|
+
|
43
|
+
### Usage
|
44
|
+
|
45
|
+
##### Basic usage
|
46
|
+
The gem uses a client model to query against the API. To create and configure client with your API keys and make requests through that add the following:
|
47
|
+
|
48
|
+
```
|
49
|
+
require 'wykop'
|
50
|
+
client = Wykop::Client.new( { app_user_key: WYKOP_DEV_APP_KEY, app_user_secret: WYKOP_DEV_APP_SECRET,
|
51
|
+
app_generated_key: WYKOP_DEV_APP_GENERATED_KEY, app_username: WYKOP_USERNAME, api_host: 'http://a.wykop.pl' })
|
52
|
+
```
|
data/Rakefile
ADDED
data/TODO.md
ADDED
data/doc/diggs/add.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
## Adding new digg
|
2
|
+
|
3
|
+
Adds new link to the waiting room.
|
4
|
+
|
5
|
+
```
|
6
|
+
client.add_new(:group => 'wykop', :url => 'https://github.com/lukaszraczylo/wykop-ruby', :title => 'test - wykop.pl ruby gem', :description => 'test gema dla API wykop.pl', :tags => 'programowanie ruby api usunto', :type => 'news', :plus18 => 0)
|
7
|
+
```
|
@@ -0,0 +1,17 @@
|
|
1
|
+
## Favorites
|
2
|
+
|
3
|
+
Checking list of favorite user links
|
4
|
+
```
|
5
|
+
client.favorite_index(:param1 => 56072)
|
6
|
+
```
|
7
|
+
|
8
|
+
Where:
|
9
|
+
* param1 - list ID
|
10
|
+
|
11
|
+
There's no parameters for following:
|
12
|
+
|
13
|
+
```
|
14
|
+
client.favorite_comments
|
15
|
+
client.favorite_entries
|
16
|
+
client.favorite_lists
|
17
|
+
```
|
data/doc/diggs/links.md
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
### Observatory
|
2
|
+
|
3
|
+
```
|
4
|
+
#Latest 50 votes
|
5
|
+
client.observatory_votes
|
6
|
+
|
7
|
+
#Latest 25 comments
|
8
|
+
client.observatory_comments
|
9
|
+
|
10
|
+
#Latest 25 microblog posts
|
11
|
+
client.observatory_entries
|
12
|
+
|
13
|
+
#Latest 25 microblog posts comments
|
14
|
+
client.observatory_entries_comments
|
15
|
+
```
|
@@ -0,0 +1,20 @@
|
|
1
|
+
## Related links
|
2
|
+
|
3
|
+
|
4
|
+
#### Voting
|
5
|
+
|
6
|
+
```
|
7
|
+
client.related_vote_up(:param1 => { :param1 => 2242488, :param2 => 27794764 })
|
8
|
+
client.related_vote_down(:param1 => { :param1 => 2242488, :param2 => 27794764 })
|
9
|
+
```
|
10
|
+
|
11
|
+
Where
|
12
|
+
|
13
|
+
* param1 => digg ID
|
14
|
+
* param2 => related ID
|
15
|
+
|
16
|
+
#### Adding new
|
17
|
+
|
18
|
+
```
|
19
|
+
client.related_add({ :param1 => 2242488, :url => 'http://github.com/lukaszraczylo/wykop-ruby', :title => '(test) ruby gem dla wykop.pl', :plus18 => 0})
|
20
|
+
```
|
data/doc/diggs/stream.md
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
## Stream
|
2
|
+
|
3
|
+
Displays information from stream ( "mikroblog" )
|
4
|
+
|
5
|
+
#### stream_show
|
6
|
+
|
7
|
+
Displays stream
|
8
|
+
|
9
|
+
```
|
10
|
+
client.stream_show
|
11
|
+
|
12
|
+
# Displays page 3 of the stream
|
13
|
+
client.stream_show({:page => 3})
|
14
|
+
```
|
15
|
+
|
16
|
+
#### stream_hot
|
17
|
+
|
18
|
+
Displays stream from 'hot' category
|
19
|
+
|
20
|
+
```
|
21
|
+
client.stream_hot
|
22
|
+
|
23
|
+
# Displays page 3 of the stream
|
24
|
+
client.stream_hot({:page => 3})
|
25
|
+
```
|
data/doc/diggs/tag.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
## Tag
|
2
|
+
|
3
|
+
Works with diggs related to tags
|
4
|
+
|
5
|
+
#### tag_show
|
6
|
+
|
7
|
+
Returns an array of diggs assigned to given tag
|
8
|
+
|
9
|
+
```
|
10
|
+
client.tag_show(:param1 => 'polityka', :type => 'links', :page => 3)
|
11
|
+
```
|
12
|
+
|
13
|
+
Available types:
|
14
|
+
```
|
15
|
+
- index ( all diggs )
|
16
|
+
- links
|
17
|
+
- entries ( mikroblog )
|
18
|
+
```
|
19
|
+
|
20
|
+
If no type specified it fails back to **index**
|
21
|
+
|
22
|
+
|
23
|
+
#### tag_observe / tag_unobserve
|
24
|
+
|
25
|
+
Add / remove tag from observed list
|
26
|
+
|
27
|
+
```
|
28
|
+
client.tag_observe(:param1 => 'polityka')
|
29
|
+
client.tag_unobserve(:param1 => 'polityka')
|
30
|
+
```
|
31
|
+
|
32
|
+
Returns **error 999 / "Cos kombinujesz" ** if you apply change more than once to the same tag.
|
33
|
+
|
34
|
+
#### tag_block / tag_unblock
|
35
|
+
|
36
|
+
Add / remove tag from blocked list
|
37
|
+
|
38
|
+
```
|
39
|
+
client.tag_block(:param1 => 'polityka')
|
40
|
+
client.tag_unblock(:param1 => 'polityka')
|
41
|
+
```
|
data/doc/diggs/tags.md
ADDED
data/doc/diggs/top.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
## Top
|
2
|
+
|
3
|
+
Displays information about top diggs
|
4
|
+
|
5
|
+
#### top_index
|
6
|
+
|
7
|
+
Hits of the year
|
8
|
+
|
9
|
+
```
|
10
|
+
client.top_index
|
11
|
+
client.top_index({:year => 2013 })
|
12
|
+
```
|
13
|
+
|
14
|
+
#### top_date
|
15
|
+
|
16
|
+
Hits of the month
|
17
|
+
|
18
|
+
```
|
19
|
+
#current
|
20
|
+
client.top_date
|
21
|
+
|
22
|
+
#year
|
23
|
+
client.top_date({:year => 2013})
|
24
|
+
|
25
|
+
#year and month
|
26
|
+
client.top_date({:year => 2013, :month => 12})
|
27
|
+
|
28
|
+
#year month and page
|
29
|
+
client.top_date({:year => 2013, :month => 12, :page => 1})
|
30
|
+
```
|
31
|
+
|
32
|
+
Default values ( if not specified ) are:
|
33
|
+
- last year
|
34
|
+
- January
|
35
|
+
- 0 page ( first )
|
36
|
+
|
37
|
+
|
38
|
+
#### top_hits
|
39
|
+
|
40
|
+
Hits, random ones - from 'wybrane hity'
|
41
|
+
|
42
|
+
```
|
43
|
+
client.top_hits
|
44
|
+
```
|
data/doc/index.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
## wykop API Gem docs
|
2
|
+
|
3
|
+
* User
|
4
|
+
* [user basics](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/user/basic.md)
|
5
|
+
* [rank](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/user/rank.md)
|
6
|
+
* [link](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/user/link.md)
|
7
|
+
* [messages](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/user/pm.md)
|
8
|
+
* Diggs
|
9
|
+
* [add new](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/add.md)
|
10
|
+
* [tags](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/tags.md)
|
11
|
+
* [links](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/links.md)
|
12
|
+
* [stream](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/stream.md)
|
13
|
+
* [popular](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/popular.md)
|
14
|
+
* [related](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/related.md)
|
15
|
+
* [favorites](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/favorites.md)
|
16
|
+
* [top diggs](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/top.md)
|
17
|
+
* [observatory](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/diggs/observatory.md)
|
18
|
+
* [Search](https://github.com/lukaszraczylo/wykop-ruby/tree/master/doc/search.md)
|
data/doc/search.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
### Search
|
2
|
+
|
3
|
+
#### Searching index
|
4
|
+
|
5
|
+
```
|
6
|
+
client.search_index({:q => 'potato'})
|
7
|
+
|
8
|
+
# Taking 3rd page of results
|
9
|
+
client.search_index({:q => 'potato', :page => 3})
|
10
|
+
```
|
11
|
+
|
12
|
+
#### Searching entries
|
13
|
+
|
14
|
+
```
|
15
|
+
client.search_entries({:q => 'potato'})
|
16
|
+
|
17
|
+
# Taking 2nd page of results
|
18
|
+
client.search_entries({:q => 'potato', :page => 2})
|
19
|
+
```
|
20
|
+
|
21
|
+
#### Searching profiles
|
22
|
+
|
23
|
+
```
|
24
|
+
client.search_profiles({:q => 'ouna-'})
|
25
|
+
```
|
26
|
+
|
27
|
+
#### Searching links
|
28
|
+
|
29
|
+
```
|
30
|
+
# what – rodzaj znalezisk: all (wszystkie), promoted (na głównej), archive (zarchiwizowane), duplicates (duplikaty)
|
31
|
+
# sort – sortowanie: best (najlepsze), diggs (po liczbie wykopów), comments (po liczbie komentarzy), new (po czasie dodania)
|
32
|
+
# kind – rodzaj znalezisk: all (wszystkie), today (dzisiaj), yesterday (wczoraj), week (ostatni tydzień), month (ostatni miesiąc), range (zakres czasu)
|
33
|
+
|
34
|
+
# Searching for 'banana'
|
35
|
+
client.search_links({:q => 'potato'})
|
36
|
+
|
37
|
+
# ... and page of results
|
38
|
+
client.search_links({:q => 'potato', :page => 2})
|
39
|
+
|
40
|
+
# ... from the main page
|
41
|
+
client.search_links({:q => 'potato', :page => 2, :what => 'promoted'})
|
42
|
+
|
43
|
+
# ... etc.
|
44
|
+
```
|
data/doc/user/basic.md
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
### User
|
2
|
+
|
3
|
+
#### Logging in
|
4
|
+
|
5
|
+
```
|
6
|
+
client = Wykop::Client.new({ app_user_key: CFG_USER_KEY, app_user_secret: CFG_USER_SECRET,
|
7
|
+
app_username: CFG_USER_NAME, app_generated_key: CFG_GEN_SECRET, api_host: 'http://a.wykop.pl' })
|
8
|
+
if client.login
|
9
|
+
(...)
|
10
|
+
end
|
11
|
+
```
|
12
|
+
|
13
|
+
#### Getting user favorites
|
14
|
+
|
15
|
+
```
|
16
|
+
client.favorites
|
17
|
+
```
|
18
|
+
|
19
|
+
#### Getting user observed diggs
|
20
|
+
|
21
|
+
```
|
22
|
+
client.observed
|
23
|
+
```
|
24
|
+
|
25
|
+
#### Getting user observed tags
|
26
|
+
|
27
|
+
```
|
28
|
+
client.tags
|
29
|
+
```
|
30
|
+
|
31
|
+
#### Getting user information
|
32
|
+
|
33
|
+
```
|
34
|
+
client.info
|
35
|
+
```
|
36
|
+
|
37
|
+
Returns all available client information ( after successful log in )
|
38
|
+
|
39
|
+
```
|
40
|
+
client.info('signup_date')
|
41
|
+
```
|
42
|
+
|
43
|
+
Returns sign up date for client account. Acceptable parameters:
|
44
|
+
|
45
|
+
```
|
46
|
+
{
|
47
|
+
"login" => "ouna-",
|
48
|
+
"email" => "224af1bddf5::banana",
|
49
|
+
"public_email" => "",
|
50
|
+
"name" => "",
|
51
|
+
"www" => "",
|
52
|
+
"jabber" => "",
|
53
|
+
"gg" => "",
|
54
|
+
"city" => "",
|
55
|
+
"about" => "Sysadmin.",
|
56
|
+
"author_group" => 1,
|
57
|
+
"links_added" => 71,
|
58
|
+
"links_published" => 6,
|
59
|
+
"comments" => 2617,
|
60
|
+
"rank" => 1380,
|
61
|
+
"followers" => 20,
|
62
|
+
"following" => 5,
|
63
|
+
"entries" => 5,
|
64
|
+
"entries_comments" => 15,
|
65
|
+
"diggs" => 3971,
|
66
|
+
"buries" => 1521,
|
67
|
+
"groups" => 0,
|
68
|
+
"related_links" => 59,
|
69
|
+
"signup_date" => "2007-12-04 11:50:25",
|
70
|
+
"avatar" => "http://xG.cdn03.imgwykop.pl/c3397992/ouna-_GMaL3lbIGi,q60.jpg",
|
71
|
+
"avatar_big" => "http://xG.cdn03.imgwykop.pl/c3397992/ouna-_GMaL3lbIGi,q150.jpg",
|
72
|
+
"avatar_med" => "http://xG.cdn03.imgwykop.pl/c3397992/ouna-_GMaL3lbIGi,q48.jpg",
|
73
|
+
"avatar_lo" => "http://xG.cdn03.imgwykop.pl/c3397992/ouna-_GMaL3lbIGi,q30.jpg",
|
74
|
+
"is_observed" => nil,
|
75
|
+
"is_blocked" => nil,
|
76
|
+
"sex" => "male",
|
77
|
+
"url" => "http://www.wykop.pl/ludzie/ouna-/",
|
78
|
+
"violation_url" => nil,
|
79
|
+
"userkey" => "aooo::potato"
|
80
|
+
}
|
81
|
+
```
|