lanyrd 0.1.1 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +7 -3
- data/lanyrd.gemspec +2 -1
- data/lib/lanyrd.rb +1 -2
- data/lib/lanyrd/client.rb +19 -16
- data/lib/lanyrd/version.rb +1 -1
- data/spec/client_spec.rb +10 -6
- metadata +23 -12
data/Readme.md
CHANGED
@@ -19,9 +19,13 @@ or bundler:
|
|
19
19
|
|
20
20
|
## Usage
|
21
21
|
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
```ruby
|
23
|
+
@lanyrd = Lanyrd::Client.new
|
24
|
+
attendees = @lanyrd.attendees("fosdem")
|
25
|
+
profile = @lanyrd.profile("teabass")
|
26
|
+
```
|
27
|
+
|
28
|
+
Full list of methods on rdoc: http://rubydoc.info/github/andrew/lanyrd/frames/index
|
25
29
|
|
26
30
|
## Development
|
27
31
|
|
data/lanyrd.gemspec
CHANGED
@@ -8,7 +8,8 @@ Gem::Specification.new do |gem|
|
|
8
8
|
gem.summary = %q{Ruby wrapper for the Lanyrd API}
|
9
9
|
gem.homepage = "http://github.com/andrew/lanyrd"
|
10
10
|
|
11
|
-
gem.add_dependency '
|
11
|
+
gem.add_dependency 'faraday_middleware', '~> 0.9'
|
12
|
+
gem.add_dependency 'hashie', '~> 1.2.0'
|
12
13
|
|
13
14
|
# Ruby 1.8 doesn't include JSON in the std lib
|
14
15
|
if RUBY_VERSION < "1.9"
|
data/lib/lanyrd.rb
CHANGED
data/lib/lanyrd/client.rb
CHANGED
@@ -1,46 +1,49 @@
|
|
1
1
|
module Lanyrd
|
2
2
|
class Client
|
3
3
|
def search(query)
|
4
|
-
get
|
4
|
+
get("search/?q=#{query}")['sections'][0]['rows']
|
5
5
|
end
|
6
6
|
|
7
7
|
def popular
|
8
|
-
get
|
8
|
+
get("search/")['sections'][0]['rows']
|
9
9
|
end
|
10
10
|
|
11
11
|
def event(slug, year = Time.now.year)
|
12
|
-
get
|
12
|
+
get("#{year}/#{slug}/")
|
13
13
|
end
|
14
14
|
|
15
15
|
def speakers(slug, year = Time.now.year)
|
16
|
-
get
|
16
|
+
get("#{year}/#{slug}/speakers/")['sections'][0]['rows']
|
17
17
|
end
|
18
18
|
|
19
19
|
def attendees(slug, year = Time.now.year)
|
20
|
-
get
|
20
|
+
get("#{year}/#{slug}/attendees/")['sections'][0]['rows']
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def schedule(slug, year = Time.now.year)
|
24
|
-
get
|
24
|
+
get("#{year}/#{slug}/schedule/")['sections'][0]['rows']
|
25
25
|
end
|
26
|
-
|
26
|
+
|
27
27
|
def profile(username)
|
28
|
-
get
|
28
|
+
get("profile/#{username}/")
|
29
|
+
end
|
30
|
+
|
31
|
+
def future_events(username)
|
32
|
+
get("profile/#{username}/action/")['events']
|
29
33
|
end
|
30
34
|
|
31
35
|
private
|
32
36
|
|
33
37
|
def get(path)
|
34
|
-
response = connection.get
|
35
|
-
decode response.body
|
36
|
-
end
|
37
|
-
|
38
|
-
def decode(data)
|
39
|
-
JSON.parse(data)
|
38
|
+
response = connection.get(path).body
|
40
39
|
end
|
41
40
|
|
42
41
|
def connection
|
43
|
-
Faraday.new
|
42
|
+
Faraday.new 'http://lanyrd.com/mobile/ios2/' do |conn|
|
43
|
+
conn.response :json
|
44
|
+
conn.use FaradayMiddleware::Mashify
|
45
|
+
conn.adapter Faraday.default_adapter
|
46
|
+
end
|
44
47
|
end
|
45
48
|
end
|
46
49
|
end
|
data/lib/lanyrd/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -5,11 +5,11 @@ describe Lanyrd::Client do
|
|
5
5
|
before(:each) { @lanyrd = Lanyrd::Client.new }
|
6
6
|
|
7
7
|
it "should search lanyrd" do
|
8
|
-
@lanyrd.search('ruby').should be_an_instance_of
|
8
|
+
@lanyrd.search('ruby').should be_an_instance_of Array
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should return popular events" do
|
12
|
-
@lanyrd.popular.should be_an_instance_of
|
12
|
+
@lanyrd.popular.should be_an_instance_of Array
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should return event information" do
|
@@ -21,18 +21,22 @@ describe Lanyrd::Client do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should return speakers for an event" do
|
24
|
-
@lanyrd.speakers('fosdem').should be_an_instance_of
|
24
|
+
@lanyrd.speakers('fosdem').should be_an_instance_of Array
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should return attendees for an event" do
|
28
|
-
@lanyrd.attendees('fosdem').should be_an_instance_of
|
28
|
+
@lanyrd.attendees('fosdem').should be_an_instance_of Array
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should return the schedule for an event" do
|
32
|
-
@lanyrd.schedule('fosdem').should be_an_instance_of
|
32
|
+
@lanyrd.schedule('fosdem').should be_an_instance_of Array
|
33
33
|
end
|
34
34
|
|
35
35
|
it "should return profile for a user" do
|
36
|
-
@lanyrd.
|
36
|
+
@lanyrd.profile('teabass').should be_an_instance_of Hash
|
37
|
+
end
|
38
|
+
|
39
|
+
it "should return a users future events" do
|
40
|
+
@lanyrd.future_events('kushalp').should be_an_instance_of Array
|
37
41
|
end
|
38
42
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lanyrd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,22 +9,33 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-02-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name:
|
16
|
-
requirement: &
|
15
|
+
name: faraday_middleware
|
16
|
+
requirement: &70208991765860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0.
|
21
|
+
version: '0.9'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70208991765860
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hashie
|
27
|
+
requirement: &70208991764860 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 1.2.0
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70208991764860
|
25
36
|
- !ruby/object:Gem::Dependency
|
26
37
|
name: rake
|
27
|
-
requirement: &
|
38
|
+
requirement: &70208991763260 !ruby/object:Gem::Requirement
|
28
39
|
none: false
|
29
40
|
requirements:
|
30
41
|
- - ! '>='
|
@@ -32,10 +43,10 @@ dependencies:
|
|
32
43
|
version: '0'
|
33
44
|
type: :development
|
34
45
|
prerelease: false
|
35
|
-
version_requirements: *
|
46
|
+
version_requirements: *70208991763260
|
36
47
|
- !ruby/object:Gem::Dependency
|
37
48
|
name: bundler
|
38
|
-
requirement: &
|
49
|
+
requirement: &70208991760300 !ruby/object:Gem::Requirement
|
39
50
|
none: false
|
40
51
|
requirements:
|
41
52
|
- - ~>
|
@@ -43,10 +54,10 @@ dependencies:
|
|
43
54
|
version: '1.0'
|
44
55
|
type: :development
|
45
56
|
prerelease: false
|
46
|
-
version_requirements: *
|
57
|
+
version_requirements: *70208991760300
|
47
58
|
- !ruby/object:Gem::Dependency
|
48
59
|
name: rspec
|
49
|
-
requirement: &
|
60
|
+
requirement: &70208991781380 !ruby/object:Gem::Requirement
|
50
61
|
none: false
|
51
62
|
requirements:
|
52
63
|
- - ~>
|
@@ -54,7 +65,7 @@ dependencies:
|
|
54
65
|
version: '2.6'
|
55
66
|
type: :development
|
56
67
|
prerelease: false
|
57
|
-
version_requirements: *
|
68
|
+
version_requirements: *70208991781380
|
58
69
|
description: Ruby wrapper for the Lanyrd API
|
59
70
|
email:
|
60
71
|
- andrewnez@gmail.com
|