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 CHANGED
@@ -19,9 +19,13 @@ or bundler:
19
19
 
20
20
  ## Usage
21
21
 
22
- @lanyrd = Lanyrd::Client.new
23
- attendees = @lanyrd.attendees("fosdem")
24
- profile = @lanyrd.profile("teabass")
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
 
@@ -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 'faraday', '~> 0.7'
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"
@@ -1,4 +1,3 @@
1
- require 'faraday'
2
- require 'json'
1
+ require 'faraday_middleware'
3
2
  require 'lanyrd/version'
4
3
  require 'lanyrd/client'
@@ -1,46 +1,49 @@
1
1
  module Lanyrd
2
2
  class Client
3
3
  def search(query)
4
- get "search/?q=#{query}"
4
+ get("search/?q=#{query}")['sections'][0]['rows']
5
5
  end
6
6
 
7
7
  def popular
8
- get "search/"
8
+ get("search/")['sections'][0]['rows']
9
9
  end
10
10
 
11
11
  def event(slug, year = Time.now.year)
12
- get "#{year}/#{slug}/"
12
+ get("#{year}/#{slug}/")
13
13
  end
14
14
 
15
15
  def speakers(slug, year = Time.now.year)
16
- get "#{year}/#{slug}/speakers/"
16
+ get("#{year}/#{slug}/speakers/")['sections'][0]['rows']
17
17
  end
18
18
 
19
19
  def attendees(slug, year = Time.now.year)
20
- get "#{year}/#{slug}/attendees/"
20
+ get("#{year}/#{slug}/attendees/")['sections'][0]['rows']
21
21
  end
22
-
22
+
23
23
  def schedule(slug, year = Time.now.year)
24
- get "#{year}/#{slug}/schedule/"
24
+ get("#{year}/#{slug}/schedule/")['sections'][0]['rows']
25
25
  end
26
-
26
+
27
27
  def profile(username)
28
- get "profile/#{username}/"
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 path
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(:url => 'http://lanyrd.com/mobile/ios2/')
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
@@ -1,3 +1,3 @@
1
1
  module Lanyrd
2
- VERSION = "0.1.1"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -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 Hash
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 Hash
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 Hash
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 Hash
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 Hash
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.schedule('teabass').should be_an_instance_of Hash
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.1.1
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-01-30 00:00:00.000000000 Z
12
+ date: 2013-02-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: faraday
16
- requirement: &70111941755380 !ruby/object:Gem::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.7'
21
+ version: '0.9'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70111941755380
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: &70111941779500 !ruby/object:Gem::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: *70111941779500
46
+ version_requirements: *70208991763260
36
47
  - !ruby/object:Gem::Dependency
37
48
  name: bundler
38
- requirement: &70111941778720 !ruby/object:Gem::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: *70111941778720
57
+ version_requirements: *70208991760300
47
58
  - !ruby/object:Gem::Dependency
48
59
  name: rspec
49
- requirement: &70111941776420 !ruby/object:Gem::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: *70111941776420
68
+ version_requirements: *70208991781380
58
69
  description: Ruby wrapper for the Lanyrd API
59
70
  email:
60
71
  - andrewnez@gmail.com