enklawa 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +10 -12
- data/lib/enklawa/api/episode.rb +14 -3
- data/lib/enklawa/api/request.rb +1 -0
- data/lib/enklawa/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MzVmOWRkYjE3MmJjZjgyY2IwOTU0NTk4MGZhMGJmMDE5ODlhOGU5Yw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZDEwMmI5NGNmMTkwOWM5NjJlZTFjOTE1MjI5MDA3NmI0NjhiODllZQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
MGU5MDMxZTgyMDBlYmExYTQ4ZTcyMTQwYmY0NDJjMTM4YWYyM2NhMzY5N2Jj
|
10
|
+
OGY4NGE1MTdhMDdkMzQ3YTY2YjkwYWZjNWI0NjBjMmY4YmQzMWJhZTM5OTk2
|
11
|
+
NmI4YmEzYzY4YjVhNTJhNTY3YjNkZjhjNWQwOTQ3ZDY2MzY2Yjk=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODI0M2RjMDcyNzllNzIxNDVhMDFmYmE5NTZmM2ExNDJjZDAzOWU3ZmNhMzg1
|
14
|
+
NzA3YmE0MjUwY2UyOGVjZjg3MzcyNzkzOWY3MGY5MzBmNGM2ODkyODEyZGI0
|
15
|
+
OTMzZWZiYzViZWEyYzAyMTQ2OWRmYzQ4OTAyODRlZWUzOTg2ZWU=
|
data/README.md
CHANGED
@@ -1,28 +1,26 @@
|
|
1
|
-
# Enklawa
|
1
|
+
# Enklawa API
|
2
2
|
|
3
|
-
|
3
|
+
This gem provides simple api wrapper for enklawa.net radio resources like programs and episodes. Everything is stored in one json file for easy fetching.
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
7
|
-
|
7
|
+
Install it using rubygems:
|
8
8
|
|
9
|
-
gem
|
9
|
+
$ gem install enklawa-api
|
10
10
|
|
11
|
-
|
11
|
+
## Usage
|
12
12
|
|
13
|
-
|
13
|
+
Next you can use it to download all programs:
|
14
14
|
|
15
|
-
|
15
|
+
$ enklawa save output.json
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
## Usage
|
17
|
+
## Example output
|
20
18
|
|
21
|
-
|
19
|
+
<http://enklawa.macbury.ninja/>
|
22
20
|
|
23
21
|
## Contributing
|
24
22
|
|
25
|
-
1. Fork it ( https://github.com/
|
23
|
+
1. Fork it ( https://github.com/macbury/enklawa-api/fork )
|
26
24
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
25
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
26
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/lib/enklawa/api/episode.rb
CHANGED
@@ -1,9 +1,20 @@
|
|
1
|
+
require "uri"
|
2
|
+
require "net/http"
|
3
|
+
|
1
4
|
module Enklawa
|
2
5
|
module Api
|
3
|
-
class Episode < Struct.new(:id, :name, :description, :mp3, :pub_date, :link, :duration)
|
6
|
+
class Episode < Struct.new(:id, :name, :description, :mp3, :pub_date, :link, :duration, :image)
|
7
|
+
|
8
|
+
def check_if_image_exists_or_use_from_program(program)
|
9
|
+
self.image = "http://www.enklawa.net/images/episodes/#{id}.jpg"
|
10
|
+
|
11
|
+
uri = URI(image)
|
4
12
|
|
5
|
-
|
6
|
-
|
13
|
+
request = Net::HTTP.new uri.host
|
14
|
+
response = request.request_head uri.path
|
15
|
+
unless response.code.to_i == 200
|
16
|
+
self.image = program.image
|
17
|
+
end
|
7
18
|
end
|
8
19
|
|
9
20
|
def to_h
|
data/lib/enklawa/api/request.rb
CHANGED
data/lib/enklawa/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: enklawa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Arkadiusz Buras
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-09-
|
11
|
+
date: 2014-09-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|