dirble 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +66 -1
- data/dirble.gemspec +1 -0
- data/lib/dirble/station.rb +7 -0
- data/lib/dirble/version.rb +1 -1
- data/spec/station_spec.rb +5 -0
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f345585103705dbb344ed1f3c0e515a9020b55a
|
4
|
+
data.tar.gz: 055debd34adb3d0ecbd3f5d3aff65935f21e08f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46e88037305c7da47fe16990e50f7db376365046d6491c6e923d28dbf1debedcc4631d7d9e61eb0e91cc6c48e67ab67e3bdfa18c5bb006c62dd3230d777fa245
|
7
|
+
data.tar.gz: 373a3ff810e34b6739b81c1260560f3530309410a36ea0fe383d03cd7d4b5850c5abbe339c8db13749ad138d30f338ee82e14b1a0a80f5a961e4d3d672f2e3b0
|
data/README.md
CHANGED
@@ -67,6 +67,14 @@ Now you are ready to go.
|
|
67
67
|
|
68
68
|
`category.stations`
|
69
69
|
|
70
|
+
* Category details
|
71
|
+
|
72
|
+
```ruby
|
73
|
+
category.id
|
74
|
+
category.name
|
75
|
+
category.description
|
76
|
+
```
|
77
|
+
|
70
78
|
## Station
|
71
79
|
|
72
80
|
* Search stations
|
@@ -77,14 +85,71 @@ Now you are ready to go.
|
|
77
85
|
|
78
86
|
`Dirble::Station.by_continent('Asia')`
|
79
87
|
|
80
|
-
* Stations by country
|
88
|
+
* Stations by country using iso code
|
81
89
|
|
82
90
|
`Dirble::Station.by_country('us')`
|
83
91
|
|
92
|
+
* Stations by country name
|
93
|
+
|
94
|
+
`Dirbel::Station.by_country_name('United States')`
|
95
|
+
|
84
96
|
* Stations amount. Check currently registered stations in Dirble.
|
85
97
|
|
86
98
|
`Dirble::Station.count`
|
87
99
|
|
100
|
+
* Find station by id
|
101
|
+
|
102
|
+
`Dirble::Station.find(100)`
|
103
|
+
|
104
|
+
* Adding new station to directory (website, name and directory are
|
105
|
+
required fields)
|
106
|
+
|
107
|
+
```ruby
|
108
|
+
params_for_creation = {
|
109
|
+
name: 'New station',
|
110
|
+
website: 'www.new-station.com',
|
111
|
+
directory: 'Pop'
|
112
|
+
}
|
113
|
+
Dirble::Station.create(params_for_creation)
|
114
|
+
```
|
115
|
+
|
116
|
+
* Station details
|
117
|
+
|
118
|
+
```ruby
|
119
|
+
station.name
|
120
|
+
station.website
|
121
|
+
station.bitrate
|
122
|
+
station.directory
|
123
|
+
station.description
|
124
|
+
station.stream_url
|
125
|
+
station.status
|
126
|
+
```
|
127
|
+
* Accessing song history by station, information available only after
|
128
|
+
`Dirble::Station.find(id)`
|
129
|
+
|
130
|
+
`station.song_history`
|
131
|
+
|
132
|
+
## Song
|
133
|
+
|
134
|
+
Songs in song history have many interesting informations.
|
135
|
+
|
136
|
+
* Name and title
|
137
|
+
|
138
|
+
`song.name`
|
139
|
+
`song.title`
|
140
|
+
|
141
|
+
* Spotify url
|
142
|
+
|
143
|
+
`song.spotify_url`
|
144
|
+
|
145
|
+
* When last played on particular station
|
146
|
+
|
147
|
+
`song.played_on`
|
148
|
+
|
149
|
+
## Coming features
|
150
|
+
|
151
|
+
* Add parallel connections with Typhoeus
|
152
|
+
|
88
153
|
## Contributing
|
89
154
|
|
90
155
|
1. Fork it ( https://github.com/[my-github-username]/dirble/fork )
|
data/dirble.gemspec
CHANGED
@@ -30,5 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_runtime_dependency "activesupport"
|
31
31
|
spec.add_runtime_dependency "faraday"
|
32
32
|
spec.add_runtime_dependency "typhoeus"
|
33
|
+
spec.add_runtime_dependency "iso_country_codes"
|
33
34
|
spec.add_development_dependency "coveralls"
|
34
35
|
end
|
data/lib/dirble/station.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'iso_country_codes'
|
2
|
+
|
1
3
|
module Dirble
|
2
4
|
class Station
|
3
5
|
REQUIRED_FIELDS = [:name, :website, :directory]
|
@@ -63,6 +65,11 @@ module Dirble
|
|
63
65
|
)
|
64
66
|
end
|
65
67
|
|
68
|
+
def by_country_name(country_name)
|
69
|
+
code = IsoCountryCodes.search_by_name(country_name).first.alpha2
|
70
|
+
by_country(code)
|
71
|
+
end
|
72
|
+
|
66
73
|
def count
|
67
74
|
response = Dirble.connection.exec_query(
|
68
75
|
request_type: :get,
|
data/lib/dirble/version.rb
CHANGED
data/spec/station_spec.rb
CHANGED
@@ -20,6 +20,11 @@ describe Dirble::Station do
|
|
20
20
|
station = Dirble::Station.by_country('us').first
|
21
21
|
expect(station.country).to eq('US')
|
22
22
|
end
|
23
|
+
|
24
|
+
it 'returns station filtered by country name' do
|
25
|
+
station = Dirble::Station.by_country_name('United States').first
|
26
|
+
expect(station.country).to eq('US')
|
27
|
+
end
|
23
28
|
end
|
24
29
|
|
25
30
|
context 'station with details' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dirble
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Przemek Mroczek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-12-
|
11
|
+
date: 2014-12-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -178,6 +178,20 @@ dependencies:
|
|
178
178
|
- - ">="
|
179
179
|
- !ruby/object:Gem::Version
|
180
180
|
version: '0'
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: iso_country_codes
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
181
195
|
- !ruby/object:Gem::Dependency
|
182
196
|
name: coveralls
|
183
197
|
requirement: !ruby/object:Gem::Requirement
|