dribbble_rap 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. data/lib/dish.rb +4 -0
  2. data/lib/dish/player.rb +27 -0
  3. data/lib/dish/shot.rb +27 -0
  4. metadata +48 -0
data/lib/dish.rb ADDED
@@ -0,0 +1,4 @@
1
+ require "httparty"
2
+ Dir[File.dirname(__FILE__) + '/dish/*.rb'].each do |file|
3
+ require file
4
+ end
@@ -0,0 +1,27 @@
1
+ module Dish
2
+ class Player
3
+
4
+ attr_accessor :username
5
+ include HTTParty
6
+ base_uri 'http://api.dribbble.com'
7
+
8
+ def initialize(username)
9
+ self.username = username
10
+ end
11
+
12
+ def profile(force = false)
13
+ force ? @profile = get_profile : @profile ||= get_profile
14
+ end
15
+
16
+ def method_missing(name, *args, &block)
17
+ profile.has_key?(name.to_s) ? profile[name.to_s] : super
18
+ end
19
+
20
+ private
21
+
22
+ def get_profile
23
+ self.class.get("/players/#{self.username}")
24
+ end
25
+
26
+ end
27
+ end
data/lib/dish/shot.rb ADDED
@@ -0,0 +1,27 @@
1
+ module Dish
2
+ class Shot
3
+
4
+ attr_accessor :id
5
+ include HTTParty
6
+ base_uri 'http://api.dribbble.com'
7
+
8
+ def initialize(id)
9
+ self.id = id
10
+ end
11
+
12
+ def profile(force = false)
13
+ force ? @profile = get_profile : @profile ||= get_profile
14
+ end
15
+
16
+ def method_missing(name, *args, &block)
17
+ profile.has_key?(id.to_s) ? profile[id.to_s] : super
18
+ end
19
+
20
+ private
21
+
22
+ def get_profile
23
+ self.class.get("/shots/#{self.id}")
24
+ end
25
+
26
+ end
27
+ end
metadata ADDED
@@ -0,0 +1,48 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dribbble_rap
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Cynical Grinch
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-02-29 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Simple wrapper for the Dribbble API.
15
+ email:
16
+ - brand.magnate@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/dish.rb
22
+ - lib/dish/player.rb
23
+ - lib/dish/shot.rb
24
+ homepage: http://www.twitter.com/cynicalgrinch
25
+ licenses: []
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ! '>='
34
+ - !ruby/object:Gem::Version
35
+ version: '0'
36
+ required_rubygems_version: !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ! '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ requirements: []
43
+ rubyforge_project:
44
+ rubygems_version: 1.8.17
45
+ signing_key:
46
+ specification_version: 3
47
+ summary: Dribbbe API
48
+ test_files: []