muri 0.0.7 → 0.0.8

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.textile CHANGED
@@ -35,7 +35,7 @@ Using muri is just as easy!
35
35
  </code>
36
36
  </pre>
37
37
 
38
- If @a.valid?@ you are good to go. If not, either the URI host was not recognized, or the path/parameters provided along with a known URI host were not recognized. When these two types of errors are encountered, an exception is caught and returned in @a.errors@ as either "Muri::NoParser" or "Muri::UnrecognizedURI". If you don't care about the type of error, just that the URI was not parsed, @a.valid?@ will give you a boolean answer.
38
+ If @a.valid?@ you are good to go. If not, either the URI host was not recognized, or the path/parameters provided along with a known URI host were not recognized. When these two types of errors are encountered, an exception is caught and returned in @a.errors@ as either "Muri::NoParser" or "Muri::UnrecognizedURI" (or potentially "URI::BadURIError" or "URI::InvalidURIError" if the URI passed is bad). If you don't care about the type of error, just whether the URI was parsed, @a.valid?@ will give you a boolean answer.
39
39
 
40
40
  Assuming the URI was successfully parsed (thus @a.valid? == true@), all media types share several common attributes:
41
41
 
@@ -62,7 +62,7 @@ Assuming the URI was successfully parsed (thus @a.valid? == true@), all media ty
62
62
 
63
63
  * Services with a @media_api_id@ also have a @media_api_type@, which indicates what sort of API call should be made (be it 'photo', 'video', 'media', 'set', 'album', or 'playlist', depending on URI type)
64
64
 
65
- * A direct media url for Youtube, Photobucket, Twitpic, and Imageshack (@http://img#{num}.imageshack.us/img#{num}/#{NUMBER}/#{IMAGENAME}@ format)
65
+ * A direct media url for Youtube, Photobucket, Twitpic, Imageshack (@http://img#{num}.imageshack.us/img#{num}/#{NUMBER}/#{IMAGENAME}@ format) and flickr (@http://farm#{num}.static.flickr.com/@ format)
66
66
 
67
67
  <pre>
68
68
  <code>
@@ -70,7 +70,7 @@ Assuming the URI was successfully parsed (thus @a.valid? == true@), all media ty
70
70
  </code>
71
71
  </pre>
72
72
 
73
- * A media landing website url for Youtube, Photobucket, Imageshack, Vimeo, Twitpic, and Flickr (flickr media_url's provide the @http://flic.kr/p/#{ID}@ short url)
73
+ * A media landing website url for Facebook (images, not video), Youtube, Photobucket, Imageshack, Vimeo, Twitpic, and Flickr (flickr returns the @http://flic.kr/p/#{ID}@ short url)
74
74
 
75
75
  <pre>
76
76
  <code>
@@ -78,7 +78,7 @@ Assuming the URI was successfully parsed (thus @a.valid? == true@), all media ty
78
78
  </code>
79
79
  </pre>
80
80
 
81
- * Content type for Imageshack, Photobucket and Flickr URI's (flickr in the @http://farm#{num}.static.flickr.com/@ format)
81
+ * Content type for Imageshack, Photobucket and Flickr (flickr in the @http://farm#{num}.static.flickr.com/@ format)
82
82
 
83
83
  <pre>
84
84
  <code>
@@ -86,7 +86,7 @@ Assuming the URI was successfully parsed (thus @a.valid? == true@), all media ty
86
86
  </code>
87
87
  </pre>
88
88
 
89
- * Thumbnails URL for Youtube Photobucket, Twitpic, and Flickr (flickr in the @http://farm#{num}.static.flickr.com/@ format)
89
+ * Thumbnails URL for Youtube, Photobucket, Twitpic, and Flickr (flickr in the @http://farm#{num}.static.flickr.com/@ format)
90
90
 
91
91
  <pre>
92
92
  <code>
data/VERSION.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :major: 0
3
3
  :minor: 0
4
- :patch: 7
4
+ :patch: 8
data/lib/muri/base.rb CHANGED
@@ -66,7 +66,7 @@ class Muri
66
66
  raise NoParser
67
67
  end
68
68
  rescue NoParser, UnsupportedURI, URI::BadURIError, URI::InvalidURIError => e
69
- @info[:errors] = "#{e}"
69
+ @info[:errors] = "#{e.class}"
70
70
  end
71
71
  end
72
72
 
@@ -34,7 +34,7 @@ class Muri
34
34
  @info[:website] = "#{url_common}/photo.php?pid=#{@info[:media_id]}&l=#{share_key}&id=#{media_creator}"
35
35
 
36
36
  # The media_api_id is the PID which can be searched for in the facebook photos table
37
- @info[:media_api_id] = (media_creator << 32) + @info[:media_id]
37
+ @info[:media_api_id] = (media_creator.to_i << 32) + @info[:media_id].to_i
38
38
  end
39
39
  end
40
40
 
@@ -34,7 +34,9 @@ class Muri
34
34
  # end
35
35
  # end
36
36
  # @info[:content_type] = $6
37
- @info[:media_thumbnail] = "http://farm#{farm}.static.flickr.com/#{server_id}/#{@info[:media_id]}_#{media_secret}_t.jpg"
37
+ url_prefix = "http://farm#{farm}.static.flickr.com/#{server_id}/#{@info[:media_id]}_#{media_secret}"
38
+ @info[:media_url] = "#{url_prefix}.jpg"
39
+ @info[:media_thumbnail] = "#{url_prefix}_t.jpg"
38
40
  elsif (@url.host + @url.path) =~ /^flic\.kr\/p\/([a-z0-9]*)/i
39
41
  @info[:media_id] = self.class.decode58($1)
40
42
  @info[:media_api_type] = FLICKR_PHOTO
data/muri.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{muri}
8
- s.version = "0.0.7"
8
+ s.version = "0.0.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["William Schneider"]
@@ -46,13 +46,13 @@ Gem::Specification.new do |s|
46
46
  s.rubygems_version = %q{1.3.5}
47
47
  s.summary = %q{Media URI Parser}
48
48
  s.test_files = [
49
- "test/error_test.rb",
50
- "test/facebook_test.rb",
51
- "test/flickr_test.rb",
52
- "test/imageshack_test.rb",
53
- "test/photobucket_test.rb",
49
+ "test/facebook_test.rb",
54
50
  "test/twitpic_test.rb",
51
+ "test/photobucket_test.rb",
55
52
  "test/vimeo_test.rb",
53
+ "test/imageshack_test.rb",
54
+ "test/error_test.rb",
55
+ "test/flickr_test.rb",
56
56
  "test/youtube_test.rb"
57
57
  ]
58
58
 
data/test/error_test.rb CHANGED
@@ -30,4 +30,8 @@ describe "Parse Errors" do
30
30
  end
31
31
  end
32
32
 
33
+ it "should not bomb if no URI is provided" do
34
+ lambda { Muri.parse '' }.should_not raise_exception()
35
+ end
36
+
33
37
  end
@@ -57,6 +57,6 @@ describe "Facebook parse second" do
57
57
  end
58
58
 
59
59
  it "should have media api id" do
60
- @a.media_api_id == 65288068484364750
60
+ @a.media_api_id == '65288068484364750'
61
61
  end
62
62
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muri
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - William Schneider
@@ -74,11 +74,11 @@ signing_key:
74
74
  specification_version: 3
75
75
  summary: Media URI Parser
76
76
  test_files:
77
- - test/error_test.rb
78
77
  - test/facebook_test.rb
79
- - test/flickr_test.rb
80
- - test/imageshack_test.rb
81
- - test/photobucket_test.rb
82
78
  - test/twitpic_test.rb
79
+ - test/photobucket_test.rb
83
80
  - test/vimeo_test.rb
81
+ - test/imageshack_test.rb
82
+ - test/error_test.rb
83
+ - test/flickr_test.rb
84
84
  - test/youtube_test.rb