hypem 0.0.2 → 0.0.3

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.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hypem Ruby Gem ![travis](https://secure.travis-ci.org/JackCA/hypem.png?branch=master) #
2
2
  ## Introduction ##
3
- This is an unoffical Ruby gem for the **Hype Machine** read-only API. It supports all of the Playlist request methods and a growing number of User methods. It currently only supports Ruby `1.9.x`.
3
+ This is an unoffical Ruby gem for the **Hype Machine** read-only API. It supports all of the Playlist request methods and a growing number of User and Blog methods. It currently only supports Ruby `1.9.x`.
4
4
 
5
5
  ## Usage ##
6
6
 
@@ -58,7 +58,9 @@ Users can be accessed via `Hypem.user('username')` and have various methods:
58
58
  #### General Methods ####
59
59
  - `user.get_profile` updates the user object with the following attributes: `full_name`, `location`, `image_url`, `followed_users_count`, `followed_items_count`, `followed_sites_blog`, and `followed_queries_count`
60
60
 
61
- - `user.get_friends` retrieves the users's friends and sets the `friends` attribute to an array of `Hypem::User` objects with extended information (similar to `get_profile`)
61
+ - `user.get_friends` retrieves the user's friends and sets the `friends` attribute to an array of `Hypem::User` objects
62
+
63
+ - `user.get_favorite_blogs` retrieves the user's favorite blogs and sets the `favorite_blogs` attribute to an array of `Hypem::Blog` objects
62
64
 
63
65
  #### Playlist Methods ####
64
66
  `Hypem::User` offers several methods for accessing a particular user's personalized playlists:
@@ -75,6 +77,13 @@ Users can be accessed via `Hypem.user('username')` and have various methods:
75
77
 
76
78
  ******
77
79
 
80
+ ### Blog ###
81
+ Blogs can be retrieved using a blog's unique id via `Hypem.blog(1234)` and has the following methods:
82
+
83
+ - `blog.get_info` -- retrieves extended information about a blog and sets `blog_image`, `blog_image_small`, `first_posted`, `followers`, `last_posted`, `site_name`, `site_url`, `total_tracks`, and `id`
84
+
85
+ ******
86
+
78
87
  ### Track ###
79
88
  All Playlist objects have a `tracks` attribute containing an array of `Hypem::Track`s. A sample object inspect is as follows:
80
89
 
@@ -99,4 +108,8 @@ All Playlist objects have a `tracks` attribute containing an array of `Hypem::Tr
99
108
  ******
100
109
 
101
110
  ## TODO ###
102
- - Add single track retrieval ability
111
+ - Blogs with given tag
112
+ - Single track info
113
+ - Authenticated Requests
114
+ - Favorite a track
115
+ - Log Playback
@@ -0,0 +1,42 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hypem.com/api/get_site_info?siteid=4632
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx/1.0.12
17
+ date:
18
+ - Sun, 25 Mar 2012 04:54:21 GMT
19
+ content-type:
20
+ - text/html
21
+ transfer-encoding:
22
+ - chunked
23
+ connection:
24
+ - close
25
+ set-cookie:
26
+ - AUTH=03%3A4508e18fa5a03f70790f7fd6b77b51c6%3A1332651260%3A1276002699%3ACA-US;
27
+ expires=Tue, 21-Mar-2028 04:54:20 GMT; path=/; domain=hypem.com
28
+ x-hacker:
29
+ - Hey, if you're reading this, you should drop us an email at hypem.com/contact,
30
+ maybe we can work together!
31
+ access-control-allow-origin:
32
+ - ! '*'
33
+ access-control-allow-headers:
34
+ - ! '*'
35
+ vary:
36
+ - Accept-Encoding
37
+ body:
38
+ encoding: ASCII-8BIT
39
+ string: ! '{"siteid":"4632","sitename":"Pasta Primavera","siteurl":"http:\/\/pastaprima.net","followers":1345,"is_favorite":null,"total_tracks":4026,"last_posted":1332515501,"first_posted":1192804200,"blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/4632.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/4632.jpg"}'
40
+ http_version:
41
+ recorded_at: Sun, 25 Mar 2012 04:54:21 GMT
42
+ recorded_with: VCR 2.0.0
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://hypem.com/api/get_favorite_blogs?username=jackca
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message:
14
+ headers:
15
+ server:
16
+ - nginx/1.0.12
17
+ date:
18
+ - Sun, 25 Mar 2012 06:27:36 GMT
19
+ content-type:
20
+ - text/html
21
+ transfer-encoding:
22
+ - chunked
23
+ connection:
24
+ - close
25
+ set-cookie:
26
+ - AUTH=03%3A95a33fbf6efa7aa97498afa21fea6e1b%3A1332656856%3A1276002699%3ACA-US;
27
+ expires=Tue, 21-Mar-2028 06:27:36 GMT; path=/; domain=hypem.com
28
+ x-hacker:
29
+ - Hey, if you're reading this, you should drop us an email at hypem.com/contact,
30
+ maybe we can work together!
31
+ access-control-allow-origin:
32
+ - ! '*'
33
+ access-control-allow-headers:
34
+ - ! '*'
35
+ vary:
36
+ - Accept-Encoding
37
+ body:
38
+ encoding: ASCII-8BIT
39
+ string: ! '[{"siteid":"13271","sitename":"Silence Nogood","siteurl":"http:\/\/silencenogood.net","blogimage":"","ts":1332633646,"hypem_url":"http:\/\/hypem.com\/blog\/silence+nogood\/13271","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/13271.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/13271.jpg"},{"siteid":"11067","sitename":"EARMILK","siteurl":"http:\/\/www.earmilk.com","blogimage":"","ts":1332628867,"hypem_url":"http:\/\/hypem.com\/blog\/earmilk\/11067","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/11067.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/11067.png"},{"siteid":"6736","sitename":"Pigeons
40
+ and Planes","siteurl":"http:\/\/pigeonsandplanes.com","blogimage":"","ts":1332620746,"hypem_url":"http:\/\/hypem.com\/blog\/pigeons+and+planes\/6736","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/6736.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/6736.jpg"},{"siteid":"14379","sitename":"Mp3
41
+ Medication","siteurl":"http:\/\/mp3medication.tumblr.com\/","blogimage":"","ts":1332608349,"hypem_url":"http:\/\/hypem.com\/blog\/mp3+medication\/14379","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/14379.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/14379.jpg"},{"siteid":"5798","sitename":"Too
42
+ Many Sebastians","siteurl":"http:\/\/toomanysebastians.net\/","blogimage":"","ts":1332558313,"hypem_url":"http:\/\/hypem.com\/blog\/too+many+sebastians\/5798","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/5798.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/5798.png"},{"siteid":"15203","sitename":"The
43
+ Fader","siteurl":"http:\/\/www.thefader.com\/category\/music\/mp3-streams\/","blogimage":"","ts":1332538213,"hypem_url":"http:\/\/hypem.com\/blog\/the+fader\/15203","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/15203.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/15203.png"},{"siteid":"6979","sitename":"Cassette
44
+ Culture","siteurl":"http:\/\/www.cassetteculture.co.uk","blogimage":"","ts":1332532949,"hypem_url":"http:\/\/hypem.com\/blog\/cassette+culture\/6979","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/6979.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/6979.jpg"},{"siteid":"11051","sitename":"Dots
45
+ & Dashes","siteurl":"http:\/\/www.dotsanddashes.co.uk\/","blogimage":"","ts":1332526080,"hypem_url":"http:\/\/hypem.com\/blog\/dots++dashes\/11051","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/11051.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/11051.jpg"},{"siteid":"5623","sitename":"RCRD
46
+ LBL","siteurl":"http:\/\/rcrdlbl.com\/","blogimage":"","ts":1332524165,"hypem_url":"http:\/\/hypem.com\/blog\/rcrd+lbl\/5623","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/5623.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/5623.png"},{"siteid":"10794","sitename":"Gigantic","siteurl":"http:\/\/www.giganticclub.com","blogimage":"","ts":1332522230,"hypem_url":"http:\/\/hypem.com\/blog\/gigantic\/10794","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/10794.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/10794.png"},{"siteid":"10441","sitename":"The
47
+ 405","siteurl":"http:\/\/thefourohfive.com","blogimage":"","ts":1332522045,"hypem_url":"http:\/\/hypem.com\/blog\/the+405\/10441","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/10441.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/10441.png"},{"siteid":"205","sitename":"Gorilla
48
+ Vs. Bear","siteurl":"http:\/\/www.gorillavsbear.net\/","blogimage":"205_gorilla.jpg","ts":1332518458,"hypem_url":"http:\/\/hypem.com\/blog\/gorilla+vs++bear\/205","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/205.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/205.jpg"},{"siteid":"4632","sitename":"Pasta
49
+ Primavera","siteurl":"http:\/\/pastaprima.net","blogimage":"","ts":1332515501,"hypem_url":"http:\/\/hypem.com\/blog\/pasta+primavera\/4632","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/4632.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/4632.jpg"},{"siteid":"3226","sitename":"First
50
+ up!","siteurl":"http:\/\/www.firstup.se","blogimage":"3226_AUTO.JPG","ts":1332313460,"hypem_url":"http:\/\/hypem.com\/blog\/first+up%21\/3226","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/3226.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/3226.png"},{"siteid":"12387","sitename":"TILT","siteurl":"http:\/\/www.tiltmagla.com","blogimage":"","ts":1332309540,"hypem_url":"http:\/\/hypem.com\/blog\/tilt\/12387","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/12387.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/12387.jpg"},{"siteid":"4658","sitename":"Waves
51
+ at Night","siteurl":"http:\/\/www.wavesatnight.com","blogimage":"","ts":1332296047,"hypem_url":"http:\/\/hypem.com\/blog\/waves+at+night\/4658","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/4658.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/4658.png"},{"siteid":"4783","sitename":"Maddecent","siteurl":"http:\/\/www.maddecent.com\/blog\/","blogimage":"","ts":1332270761,"hypem_url":"http:\/\/hypem.com\/blog\/maddecent\/4783","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/4783.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/4783.png"},{"siteid":"1851","sitename":"Different
52
+ Kitchen","siteurl":"http:\/\/different-kitchen.com\/","blogimage":"1851_AUTO.JPG","ts":1332188627,"hypem_url":"http:\/\/hypem.com\/blog\/different+kitchen\/1851","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/1851.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/1851.png"},{"siteid":"3364","sitename":"Disco
53
+ Delicious","siteurl":"http:\/\/www.discodelicious.com\/","blogimage":"3364_AUTO.JPG","ts":1331794043,"hypem_url":"http:\/\/hypem.com\/blog\/disco+delicious\/3364","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/3364.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/3364.png"},{"siteid":"16086","sitename":"Cher","siteurl":"http:\/\/www.welovetocher.com","blogimage":"","ts":1331555505,"hypem_url":"http:\/\/hypem.com\/blog\/cher\/16086","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/16086.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/16086.jpg"},{"siteid":"10215","sitename":"gottadancedirty","siteurl":"http:\/\/gottadancedirty.com\/","blogimage":"","ts":1331338536,"hypem_url":"http:\/\/hypem.com\/blog\/gottadancedirty\/10215","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/10215.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/10215.jpg"},{"siteid":"10513","sitename":"We
54
+ Listen For You","siteurl":"http:\/\/welistenforyou.blogspot.com\/","blogimage":"","ts":1331240739,"hypem_url":"http:\/\/hypem.com\/blog\/we+listen+for+you\/10513","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/10513.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/10513.jpg"},{"siteid":"4142","sitename":"Hyperbole","siteurl":"http:\/\/hyperbole.tv\/","blogimage":"","ts":1330397788,"hypem_url":"http:\/\/hypem.com\/blog\/hyperbole\/4142","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/4142.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/4142.png"},{"siteid":"10315","sitename":"Trials
55
+ + Tribulations","siteurl":"http:\/\/tribulationstrials.wordpress.com","blogimage":"","ts":1328216939,"hypem_url":"http:\/\/hypem.com\/blog\/trials++tribulations\/10315","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/10315.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/10315.png"},{"siteid":"4416","sitename":"JP''s
56
+ Blog","siteurl":"http:\/\/jpsblog.net\/","blogimage":"","ts":1326873737,"hypem_url":"http:\/\/hypem.com\/blog\/jp%27s+blog\/4416","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/4416.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/4416.png"},{"siteid":"11095","sitename":"DayBowBow","siteurl":"http:\/\/daybowbow.net","blogimage":"","ts":1299688221,"hypem_url":"http:\/\/hypem.com\/blog\/daybowbow\/11095","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/11095.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/11095.png"},{"siteid":"11926","sitename":"Fingers
57
+ Become Thumbs","siteurl":"http:\/\/fingersbecomethumbs.wordpress.com\/","blogimage":"","ts":1289413473,"hypem_url":"http:\/\/hypem.com\/blog\/fingers+become+thumbs\/11926","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/11926.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/11926.png"},{"siteid":"2387","sitename":"discodust","siteurl":"http:\/\/discodust.blogspot.com","blogimage":"2387_AUTO.JPG","ts":1286231413,"hypem_url":"http:\/\/hypem.com\/blog\/discodust\/2387","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/2387.jpg","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/2387.jpg"},{"siteid":"3488","sitename":"IHEARTCOMIX!","siteurl":"http:\/\/www.iheartcomix.com","blogimage":"3488_AUTO.JPG","ts":1281748418,"hypem_url":"http:\/\/hypem.com\/blog\/iheartcomix%21\/3488","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/3488.png","blog_image_small":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/3488.png"},{"siteid":"10074","sitename":"STEREO\/PASTE","siteurl":"http:\/\/stereopaste.blogspot.com\/","blogimage":"","ts":1273732200,"hypem_url":"http:\/\/hypem.com\/blog\/stereopaste\/10074","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/default.png"},{"siteid":"2542","sitename":"Missingtoof","siteurl":"http:\/\/www.missingtoof.com\/","blogimage":"2542_AUTO.JPG","ts":1261079494,"hypem_url":"http:\/\/hypem.com\/blog\/missingtoof\/2542","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/default.png"},{"siteid":"10429","sitename":"Never
58
+ Sleep Again","siteurl":"http:\/\/neversleepagain.com","blogimage":"","ts":1259680138,"hypem_url":"http:\/\/hypem.com\/blog\/never+sleep+again\/10429","blog_image":"http:\/\/static-ak.hypem.net\/images\/blog_images\/small\/default.png"}]'
59
+ http_version:
60
+ recorded_at: Sun, 25 Mar 2012 06:27:36 GMT
61
+ recorded_with: VCR 2.0.0
data/hypem.gemspec CHANGED
@@ -11,6 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.summary = "a Ruby wrapper for the Hype Machine read-only API"
12
12
 
13
13
  s.rubyforge_project = "hypem"
14
+ s.required_ruby_version = Gem::Requirement.new(">= 1.9.2")
14
15
 
15
16
  s.files = `git ls-files`.split("\n")
16
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
data/lib/hypem.rb CHANGED
@@ -3,6 +3,7 @@ require "hypem/request"
3
3
  require "hypem/user"
4
4
  require "hypem/track"
5
5
  require "hypem/playlist"
6
+ require "hypem/blog"
6
7
 
7
8
  module Hypem
8
9
 
data/lib/hypem/blog.rb ADDED
@@ -0,0 +1,36 @@
1
+ require 'hashie'
2
+
3
+ module Hypem
4
+ class Blog
5
+ attr_reader :blog_image, :blog_image_small, :first_posted,
6
+ :followers, :last_posted, :site_name, :site_url,
7
+ :total_tracks, :id
8
+
9
+ def initialize(*args)
10
+ if args.count == 1
11
+ @id = args.first.is_a?(Integer) ? args.first : args.first.to_i
12
+ end
13
+ end
14
+
15
+ def get_info
16
+ response = Request.new("/api/get_site_info?siteid=#{@id}").get.response.body
17
+ update_from_response(response)
18
+ return self
19
+ end
20
+
21
+ def update_from_response(rsp)
22
+ @blog_image ||= rsp['blog_image']
23
+ @blog_image_small ||= rsp['blog_image_small']
24
+ @followers ||= rsp['followers']
25
+ @id ||= rsp['siteid']
26
+ @site_name ||= rsp['sitename']
27
+ @site_url ||= rsp['siteurl']
28
+ @total_tracks ||= rsp['total_tracks']
29
+
30
+ # only from get_info
31
+ @first_posted ||= Time.at(rsp['first_posted']) unless rsp['first_posted'].nil?
32
+ @last_posted ||= Time.at(rsp['last_posted']) unless rsp['last_posted'].nil?
33
+
34
+ end
35
+ end
36
+ end
data/lib/hypem/user.rb CHANGED
@@ -2,24 +2,37 @@ module Hypem
2
2
  class User
3
3
  attr_reader :full_name, :joined_at, :location, :twitter_username, :image_url,
4
4
  :followed_users_count, :followed_items_count, :followed_sites_count,
5
- :followed_queries_count, :friends
5
+ :followed_queries_count, :friends, :favorite_blogs
6
6
 
7
7
  def initialize(name)
8
8
  raise ArgumentError unless name.is_a? String
9
9
  @name = name
10
10
  end
11
11
 
12
+ def api_request(path)
13
+ Request.new("/api/#{path}?username=#{@name}").get.response.body
14
+ end
15
+
12
16
  def get_profile
13
- response = Request.new("/api/get_profile?username=#{@name}").get.response.body
17
+ response = api_request('get_profile')
14
18
  update_from_response(response)
15
19
  return self
16
20
  end
17
21
 
22
+ def get_favorite_blogs
23
+ response = api_request('get_favorite_blogs')
24
+ @favorite_blogs = response.map do |r|
25
+ blog = Hypem::Blog.new(r['siteid'])
26
+ blog.update_from_response(r)
27
+ blog
28
+ end
29
+ return self
30
+ end
31
+
18
32
  def get_friends
19
- array_response = Request.new("/api/get_friends?username=#{@name}").get.response.body
20
- @friends = array_response.map do |r|
21
- name = r['username']
22
- user = User.new(name)
33
+ response = api_request('get_friends')
34
+ @friends = response.map do |r|
35
+ user = User.new(r['username'])
23
36
  user.update_from_response(r)
24
37
  user
25
38
  end
data/lib/hypem/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hypem
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
data/spec/blog_spec.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Hypem::Blog do
4
+ context "when initialized with a single string argument" do
5
+ let(:blog) do
6
+ Hypem::Blog.new(4632)
7
+ end
8
+
9
+ it "is successfully initialized" do
10
+ blog.should be_a Hypem::Blog
11
+ end
12
+
13
+ it "sets id attribute" do
14
+ blog.id.should == 4632
15
+ end
16
+
17
+ it "converts strings to integers" do
18
+ Hypem::Blog.new('4632').id.should === 4632
19
+ end
20
+
21
+ describe ".get_info" do
22
+ subject do
23
+ VCR.use_cassette('blog') {blog.get_info}
24
+ end
25
+ specify {subject.should be_a Hypem::Blog}
26
+ specify {subject.site_name.should == 'Pasta Primavera'}
27
+ specify {subject.blog_image.should == 'http://static-ak.hypem.net/images/blog_images/4632.jpg'}
28
+ specify {subject.blog_image_small.should == 'http://static-ak.hypem.net/images/blog_images/small/4632.jpg'}
29
+ specify {subject.site_url.should == 'http://pastaprima.net'}
30
+ specify {subject.total_tracks.should == 4026}
31
+ specify {subject.first_posted.should be_a Time}
32
+ specify {subject.last_posted.should be_a Time}
33
+ specify {subject.followers.should == 1345}
34
+
35
+ end
36
+ end
37
+
38
+ end
data/spec/user_spec.rb CHANGED
@@ -73,4 +73,18 @@ describe Hypem::User do
73
73
  end
74
74
  end
75
75
 
76
+ describe ".get_favorite_blogs" do
77
+ let(:user_with_favorite_blogs) do
78
+ VCR.use_cassette('user_favorite_blogs') {user.get_favorite_blogs}
79
+ end
80
+
81
+ subject {user_with_favorite_blogs}
82
+ its(:favorite_blogs) {should be_an Array}
83
+
84
+ it "should have an array of Blogs" do
85
+ subject.favorite_blogs.first.should be_a Hypem::Blog
86
+ end
87
+
88
+ end
89
+
76
90
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hypem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70304769757740 !ruby/object:Gem::Requirement
16
+ requirement: &70314354528100 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2.6'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70304769757740
24
+ version_requirements: *70314354528100
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: vcr
27
- requirement: &70304769757240 !ruby/object:Gem::Requirement
27
+ requirement: &70314354527640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '2.0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70304769757240
35
+ version_requirements: *70314354527640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rake
38
- requirement: &70304769756860 !ruby/object:Gem::Requirement
38
+ requirement: &70314354527260 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70304769756860
46
+ version_requirements: *70314354527260
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: faraday
49
- requirement: &70304769756320 !ruby/object:Gem::Requirement
49
+ requirement: &70314354526720 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '0.7'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70304769756320
57
+ version_requirements: *70314354526720
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: multi_json
60
- requirement: &70304769755820 !ruby/object:Gem::Requirement
60
+ requirement: &70314354526220 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: '1.1'
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *70304769755820
68
+ version_requirements: *70314354526220
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: hashie
71
- requirement: &70304769755360 !ruby/object:Gem::Requirement
71
+ requirement: &70314354525760 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: '1.2'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *70304769755360
79
+ version_requirements: *70314354525760
80
80
  description:
81
81
  email:
82
82
  - jackcanderson@gmail.com
@@ -90,6 +90,7 @@ files:
90
90
  - Gemfile
91
91
  - README.md
92
92
  - Rakefile
93
+ - fixtures/vcr_cassettes/blog.yml
93
94
  - fixtures/vcr_cassettes/blog_playlist.yml
94
95
  - fixtures/vcr_cassettes/feed_playlist.yml
95
96
  - fixtures/vcr_cassettes/fresh_playlist.yml
@@ -99,16 +100,19 @@ files:
99
100
  - fixtures/vcr_cassettes/loved_playlist.yml
100
101
  - fixtures/vcr_cassettes/obsessed_playlist.yml
101
102
  - fixtures/vcr_cassettes/popular_playlist.yml
103
+ - fixtures/vcr_cassettes/user_favorite_blogs.yml
102
104
  - fixtures/vcr_cassettes/user_friends.yml
103
105
  - fixtures/vcr_cassettes/user_profile.yml
104
106
  - hypem.gemspec
105
107
  - lib/hypem.rb
108
+ - lib/hypem/blog.rb
106
109
  - lib/hypem/playlist.rb
107
110
  - lib/hypem/request.rb
108
111
  - lib/hypem/response.rb
109
112
  - lib/hypem/track.rb
110
113
  - lib/hypem/user.rb
111
114
  - lib/hypem/version.rb
115
+ - spec/blog_spec.rb
112
116
  - spec/hypem_spec.rb
113
117
  - spec/playlist_spec.rb
114
118
  - spec/request_spec.rb
@@ -127,10 +131,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
127
131
  requirements:
128
132
  - - ! '>='
129
133
  - !ruby/object:Gem::Version
130
- version: '0'
131
- segments:
132
- - 0
133
- hash: 2867882639312664006
134
+ version: 1.9.2
134
135
  required_rubygems_version: !ruby/object:Gem::Requirement
135
136
  none: false
136
137
  requirements:
@@ -139,7 +140,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  version: '0'
140
141
  segments:
141
142
  - 0
142
- hash: 2867882639312664006
143
+ hash: 2921270312575464942
143
144
  requirements: []
144
145
  rubyforge_project: hypem
145
146
  rubygems_version: 1.8.10
@@ -147,6 +148,7 @@ signing_key:
147
148
  specification_version: 3
148
149
  summary: a Ruby wrapper for the Hype Machine read-only API
149
150
  test_files:
151
+ - spec/blog_spec.rb
150
152
  - spec/hypem_spec.rb
151
153
  - spec/playlist_spec.rb
152
154
  - spec/request_spec.rb