imasquerade 0.2.4 → 0.3.0

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 69692b636617f79d4361a6a7d3aac29d73c72dae
4
+ data.tar.gz: e228a907cc67dbe4c84179a224fbee3645497e8b
5
+ SHA512:
6
+ metadata.gz: 41a1725df2f06204c2c619ccb005113ffa8820ce7c74c90b43f5823299b5efc0924ed65e7c4a9cbd3204a1fc2e537a1f46295935a4901f1ca16d58620b59ed99
7
+ data.tar.gz: f9bb4169501217f72fcd27165fe0c62176271063972a376488c9598a4dd1ddd89b6e227f8fd5c6d735adde197c4a2bcbcde4cf8d6775c0ba16dadee1e46f8fb1
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --require spec_helper
3
+ --format documentation
@@ -0,0 +1 @@
1
+ imasquerade
@@ -0,0 +1 @@
1
+ 2.1
@@ -1,3 +1,5 @@
1
1
  rvm:
2
- - 1.9.2
3
2
  - 1.9.3
3
+ - 2.0.0
4
+ - 2.1
5
+ - ruby-head
@@ -8,16 +8,15 @@ source feed url and is subsequently returned.
8
8
 
9
9
  == Requirements
10
10
 
11
- * uri
12
- * curb => 0.7.10
13
- * nokogiri => 1.4.4
11
+ * httparty
12
+ * multi_json
14
13
 
15
- This project was built and tested against ruby 1.9.2p160 (2011-01-16 revision 30579) [x86_64-darwin10.6.0]
14
+ This project was built and tested against ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin14.0.0]
16
15
 
17
16
  == Usage
18
17
 
19
- Imasquerade::Extractor.parse_itunes_uri("http://itunes.apple.com/us/podcast/the-f-u-sports-talk-podcast/id356478903")
20
- # returns "http://www.urannonline.com/Collection_Site/The_F_U_Sports_Talk_Podcast/rss.xml"
18
+ Imasquerade.parse_itunes_uri("https://itunes.apple.com/us/podcast/wdw-radio-show-your-walt-disney/id215517191?mt=2")
19
+ # returns "http://www.wdwradio.com/xml/wdwradio.xml"
21
20
 
22
21
  Technically, the parser can take the url in another format (e.g., id=356478903).
23
22
  However I do not believe Apple is using this format any longer. Regardless the
@@ -35,6 +34,6 @@ capability is there.
35
34
 
36
35
  == Copyright
37
36
 
38
- Copyright (c) 2011 Ryan Lovelett. See LICENSE.txt for
37
+ Copyright (c) 2011-2014 Ryan Lovelett. See LICENSE.txt for
39
38
  further details.
40
39
 
data/Rakefile CHANGED
@@ -1,11 +1,11 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
1
  require 'bundler/gem_tasks'
4
2
 
5
- Rake::TestTask.new(:test) do |test|
6
- test.libs << 'lib' << 'test'
7
- test.pattern = 'test/**/test_*.rb'
8
- test.verbose = true
9
- end
3
+ begin
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
10
7
 
11
- task :default => :test
8
+ task :default => :spec
9
+ rescue LoadError
10
+ # no rspec available
11
+ end
@@ -16,10 +16,10 @@ Gem::Specification.new do |gem|
16
16
  gem.require_paths = ["lib"]
17
17
  gem.version = Imasquerade::VERSION
18
18
 
19
- gem.add_dependency "curb"
20
- gem.add_dependency "nokogiri"
21
- gem.add_dependency "plist"
22
- gem.add_dependency "colorize"
23
- gem.add_development_dependency "rake"
24
- gem.add_development_dependency "shoulda"
19
+ gem.add_dependency 'httparty', '~> 0.13.0'
20
+ gem.add_dependency 'multi_json', '~> 1.10.0'
21
+ gem.add_development_dependency 'rake', '~> 10.3.0'
22
+ gem.add_development_dependency 'rspec', '~> 3.1.0'
23
+ gem.add_development_dependency 'vcr', '~> 2.9.0'
24
+ gem.add_development_dependency 'webmock', '~> 1.20.0'
25
25
  end
@@ -1,10 +1,7 @@
1
1
  $:.unshift(File.dirname(__FILE__)) unless
2
2
  $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
3
 
4
- require 'uri'
5
- require 'curb'
6
- require 'nokogiri'
7
- require 'plist'
8
- require 'colorize'
4
+ require 'httparty'
5
+ require 'multi_json'
9
6
 
10
7
  require 'imasquerade/extractor'
@@ -1,69 +1,17 @@
1
1
  module Imasquerade
2
- class Extractor
3
- public
4
- def Extractor.parse_itunes_uri(uri='')
5
- return Extractor.fetch_and_parse_feed_from_apple(uri)
6
- end
7
- def Extractor.debug_output(uri='')
8
- id = Extractor.itunes_id(uri)
9
- doc = Extractor.get_raw_string(uri)
10
- File.open("#{id}.xml", 'w') {|f| f.write(doc) }
11
- end
12
- private
13
- def Extractor.uri_orig(id='')
14
- # This is the original place to check
15
- @@uri_orig = "http://itunes.apple.com/podcast/id#{id}"
16
- end
2
+ @itunes_id_regex = /(?:id=?)(?<id>[0-9]+)/i
17
3
 
18
- def Extractor.uri_redirect(id='')
19
- # Check here if there is a redirect
20
- @@uri_redirect = "http://itunes.apple.com/WebObjects/DZR.woa/wa/viewPodcast?id=#{id}"
21
- end
4
+ def self.parse_itunes_uri(uri)
5
+ # Extract the iTunes id from the URI
6
+ id = uri.match(@itunes_id_regex)[:id]
22
7
 
23
- def Extractor.itunes_id(url="")
24
- /(?:id=?)([0-9]+)/i =~ url
25
- return $1
26
- end
8
+ # Get raw JSON search
9
+ response = HTTParty.get('https://itunes.apple.com/lookup', {query: {id: id}})
27
10
 
28
- def Extractor.get_raw_string(uri="")
29
- # In case there is some sort of error
30
- begin
31
- response = Curl::Easy.perform(uri) do |curl|
32
- curl.headers["User-Agent"] = 'iTunes/10.1.1'
33
- end
34
- return response.body_str
35
- rescue Nokogiri::XML::SyntaxError => e
36
- puts "Caught exception: #{e}".colorize(:red)
37
- return nil
38
- rescue Curl::Err::HostResolutionError => e
39
- puts "Caught exception: #{e}".colorize(:red)
40
- return nil
41
- rescue Curl::Err::RecvError => e
42
- puts "Caught exception: #{e}".colorize(:red)
43
- return nil
44
- end
45
- end
11
+ # Parse the JSON to a Hash
12
+ hash = MultiJson.load(response.body, symbolize_keys: true)
46
13
 
47
- def Extractor.fetch_and_parse_feed_from_apple(url)
48
- id = Extractor.itunes_id(url)
49
- response = Extractor.get_raw_string(url)
50
- reader = Nokogiri::XML(response)
51
- feed_url = reader.xpath('//@feed-url')
52
- return feed_url[0].value unless feed_url.count == 0
53
- response.force_encoding("UTF-8") if response.encoding == Encoding::ASCII_8BIT
54
- begin
55
- list = Plist::parse_xml(response)
56
- rescue RuntimeError => bang
57
- list = {}
58
- end
59
- if list.has_key?('action') && list['action']['kind'] == "Goto" then
60
- response = Extractor.fetch_and_parse_feed_from_apple(list['action']['url'])
61
- return response
62
- elsif list.has_key?('dialog')
63
- throw list['dialog']['explanation']
64
- end
65
- File.open("#{id}.html", 'w') {|f| f.write(response) }
66
- throw "The feed was either empty, or mal-formed."
67
- end
14
+ # Extract the first feed URL
15
+ hash[:results].first[:feedUrl] if hash.has_key?(:results) && hash[:resultCount] > 0
68
16
  end
69
17
  end
@@ -1,3 +1,3 @@
1
1
  module Imasquerade
2
- VERSION = "0.2.4"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -0,0 +1,172 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://itunes.apple.com/lookup?id=215517191
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept:
11
+ - ! '*/*'
12
+ User-Agent:
13
+ - Ruby
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ X-Apple-Jingle-Correlation-Key:
20
+ - YACMCIYJE2WBW
21
+ X-Apple-Translated-Wo-Url:
22
+ - /WebObjects/MZStoreServices.woa/ws/wsLookup?id=215517191&urlDesc=
23
+ X-Apple-Orig-Url:
24
+ - https://itunes.apple.com/lookup?id=215517191
25
+ X-Apple-Application-Site:
26
+ - NWK
27
+ Apple-Timing-App:
28
+ - 14 ms
29
+ Content-Type:
30
+ - text/javascript; charset=utf-8
31
+ X-Apple-Application-Instance:
32
+ - '1075018'
33
+ X-Webobjects-Loadaverage:
34
+ - '0'
35
+ Server:
36
+ - ATS/4.1.0
37
+ X-Apple-Ats-Cache-Key:
38
+ - /17.154.42.217/80/lookup/browser/https?id=215517191
39
+ Cache-Control:
40
+ - no-transform, max-age=1
41
+ Date:
42
+ - Thu, 06 Nov 2014 02:14:02 GMT
43
+ Content-Length:
44
+ - '2084'
45
+ Connection:
46
+ - keep-alive
47
+ X-Apple-Partner:
48
+ - origin.0
49
+ body:
50
+ encoding: US-ASCII
51
+ string: ! "\n\n\n{\n \"resultCount\":1,\n \"results\": [\n{\"wrapperType\":\"track\",
52
+ \"kind\":\"podcast\", \"artistId\":256278813, \"collectionId\":215517191,
53
+ \"trackId\":215517191, \"artistName\":\"Lou Mongello - Disney Expert, Entrepreneur,
54
+ Host, Author and Speaker\", \"collectionName\":\"The WDW Radio Show - Your
55
+ Walt Disney World Information Station\", \"trackName\":\"The WDW Radio Show
56
+ - Your Walt Disney World Information Station\", \"collectionCensoredName\":\"The
57
+ WDW Radio Show - Your Walt Disney World Information Station\", \"trackCensoredName\":\"The
58
+ WDW Radio Show - Your Walt Disney World Information Station\", \"artistViewUrl\":\"https://itunes.apple.com/us/artist/travel-cast-network/id256278813?mt=2&uo=4\",
59
+ \"collectionViewUrl\":\"https://itunes.apple.com/us/podcast/wdw-radio-show-your-walt-disney/id215517191?mt=2&uo=4\",
60
+ \"feedUrl\":\"http://www.wdwradio.com/xml/wdwradio.xml\", \"trackViewUrl\":\"https://itunes.apple.com/us/podcast/wdw-radio-show-your-walt-disney/id215517191?mt=2&uo=4\",
61
+ \"artworkUrl30\":\"http://a5.mzstatic.com/us/r30/Podcasts6/v4/cf/f9/be/cff9be62-faa0-ff06-2418-e724936b57cf/mza_5079045456985578759.30x30-50.jpg\",
62
+ \"artworkUrl60\":\"http://a4.mzstatic.com/us/r30/Podcasts6/v4/cf/f9/be/cff9be62-faa0-ff06-2418-e724936b57cf/mza_5079045456985578759.60x60-50.jpg\",
63
+ \"artworkUrl100\":\"http://a2.mzstatic.com/us/r30/Podcasts6/v4/cf/f9/be/cff9be62-faa0-ff06-2418-e724936b57cf/mza_5079045456985578759.100x100-75.jpg\",
64
+ \"collectionPrice\":0.00, \"trackPrice\":0.00, \"trackRentalPrice\":0, \"collectionHdPrice\":0,
65
+ \"trackHdPrice\":0, \"trackHdRentalPrice\":0, \"releaseDate\":\"2014-10-30T22:05:00Z\",
66
+ \"collectionExplicitness\":\"cleaned\", \"trackExplicitness\":\"cleaned\",
67
+ \"trackCount\":301, \"country\":\"USA\", \"currency\":\"USD\", \"primaryGenreName\":\"Places
68
+ & Travel\", \"contentAdvisoryRating\":\"Clean\", \"radioStationUrl\":\"https://itunes.apple.com/station/idra.215517191\",
69
+ \"artworkUrl600\":\"http://a3.mzstatic.com/us/r30/Podcasts6/v4/cf/f9/be/cff9be62-faa0-ff06-2418-e724936b57cf/mza_5079045456985578759.600x600-75.jpg\",
70
+ \"genreIds\":[\"1320\", \"26\", \"1324\", \"1305\"], \"genres\":[\"Places
71
+ & Travel\", \"Podcasts\", \"Society & Culture\", \"Kids & Family\"]}]\n}\n\n\n"
72
+ http_version:
73
+ recorded_at: Thu, 06 Nov 2014 02:14:02 GMT
74
+ - request:
75
+ method: get
76
+ uri: https://itunes.apple.com/lookup?id=347207945
77
+ body:
78
+ encoding: US-ASCII
79
+ string: ''
80
+ headers:
81
+ Accept-Encoding:
82
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
83
+ Accept:
84
+ - "*/*"
85
+ User-Agent:
86
+ - Ruby
87
+ response:
88
+ status:
89
+ code: 200
90
+ message: OK
91
+ headers:
92
+ X-Apple-Jingle-Correlation-Key:
93
+ - FTFZ5LOGO6DO2
94
+ X-Apple-Translated-Wo-Url:
95
+ - "/WebObjects/MZStoreServices.woa/ws/wsLookup?id=347207945&urlDesc="
96
+ X-Apple-Orig-Url:
97
+ - https://itunes.apple.com/lookup?id=347207945
98
+ X-Apple-Application-Site:
99
+ - ST11
100
+ Apple-Timing-App:
101
+ - 15 ms
102
+ Content-Type:
103
+ - text/javascript; charset=utf-8
104
+ X-Apple-Application-Instance:
105
+ - '2089677'
106
+ X-Webobjects-Loadaverage:
107
+ - '0'
108
+ Server:
109
+ - ATS/4.1.0
110
+ X-Apple-Ats-Cache-Key:
111
+ - "/17.173.38.166/80/lookup/browser/https?id=347207945"
112
+ Vary:
113
+ - Accept-Encoding
114
+ Cache-Control:
115
+ - no-transform, max-age=1
116
+ Date:
117
+ - Thu, 06 Nov 2014 03:02:37 GMT
118
+ Content-Length:
119
+ - '1898'
120
+ Connection:
121
+ - keep-alive
122
+ X-Apple-Partner:
123
+ - origin.0
124
+ body:
125
+ encoding: ASCII-8BIT
126
+ string: !binary |-
127
+ CgoKewogInJlc3VsdENvdW50IjoxLAogInJlc3VsdHMiOiBbCnsid3JhcHBl
128
+ clR5cGUiOiJ0cmFjayIsICJraW5kIjoicG9kY2FzdCIsICJhcnRpc3RJZCI6
129
+ ODI1NzAxODk5LCAiY29sbGVjdGlvbklkIjozNDcyMDc5NDUsICJ0cmFja0lk
130
+ IjozNDcyMDc5NDUsICJhcnRpc3ROYW1lIjoiQ2hhcmxlcyBNYXggV29vZCIs
131
+ ICJjb2xsZWN0aW9uTmFtZSI6IlRlYWNoIE1lIFRvIENvZGUgwrsgU2NyZWVu
132
+ Y2FzdHMgKGlQaG9uZS9pUG9kKSIsICJ0cmFja05hbWUiOiJUZWFjaCBNZSBU
133
+ byBDb2RlIMK7IFNjcmVlbmNhc3RzIChpUGhvbmUvaVBvZCkiLCAiY29sbGVj
134
+ dGlvbkNlbnNvcmVkTmFtZSI6IlRlYWNoIE1lIFRvIENvZGUgwrsgU2NyZWVu
135
+ Y2FzdHMgKGlQaG9uZS9pUG9kKSIsICJ0cmFja0NlbnNvcmVkTmFtZSI6IlRl
136
+ YWNoIE1lIFRvIENvZGUgwrsgU2NyZWVuY2FzdHMgKGlQaG9uZS9pUG9kKSIs
137
+ ICJhcnRpc3RWaWV3VXJsIjoiaHR0cHM6Ly9pdHVuZXMuYXBwbGUuY29tL3Vz
138
+ L2FydGlzdC9kZXZjaGF0LnR2L2lkODI1NzAxODk5P210PTImdW89NCIsICJj
139
+ b2xsZWN0aW9uVmlld1VybCI6Imh0dHBzOi8vaXR1bmVzLmFwcGxlLmNvbS91
140
+ cy9wb2RjYXN0L3RlYWNoLW1lLXRvLWNvZGUtc2NyZWVuY2FzdHMvaWQzNDcy
141
+ MDc5NDU/bXQ9MiZ1bz00IiwgImZlZWRVcmwiOiJodHRwOi8vZmVlZHMuZmVl
142
+ ZHdyZW5jaC5jb20vVGVhY2hNZVRvQ29kZWlQaG9uZS5yc3MiLCAidHJhY2tW
143
+ aWV3VXJsIjoiaHR0cHM6Ly9pdHVuZXMuYXBwbGUuY29tL3VzL3BvZGNhc3Qv
144
+ dGVhY2gtbWUtdG8tY29kZS1zY3JlZW5jYXN0cy9pZDM0NzIwNzk0NT9tdD0y
145
+ JnVvPTQiLCAiYXJ0d29ya1VybDMwIjoiaHR0cDovL2EyLm16c3RhdGljLmNv
146
+ bS91cy9yMzAvUG9kY2FzdHMzL3Y0LzAzLzg5L2NiLzAzODljYjdjLTQ5ZDkt
147
+ NzljNy1lYmI4LWM2MTZhY2U5NDdmZS9temFfNTc1NjgzMTAyOTk1NTQxNzA5
148
+ My4zMHgzMC01MC5qcGciLCAiYXJ0d29ya1VybDYwIjoiaHR0cDovL2E0Lm16
149
+ c3RhdGljLmNvbS91cy9yMzAvUG9kY2FzdHMzL3Y0LzAzLzg5L2NiLzAzODlj
150
+ YjdjLTQ5ZDktNzljNy1lYmI4LWM2MTZhY2U5NDdmZS9temFfNTc1NjgzMTAy
151
+ OTk1NTQxNzA5My42MHg2MC01MC5qcGciLCAiYXJ0d29ya1VybDEwMCI6Imh0
152
+ dHA6Ly9hMi5tenN0YXRpYy5jb20vdXMvcjMwL1BvZGNhc3RzMy92NC8wMy84
153
+ OS9jYi8wMzg5Y2I3Yy00OWQ5LTc5YzctZWJiOC1jNjE2YWNlOTQ3ZmUvbXph
154
+ XzU3NTY4MzEwMjk5NTU0MTcwOTMuMTAweDEwMC03NS5qcGciLCAiY29sbGVj
155
+ dGlvblByaWNlIjowLjAwLCAidHJhY2tQcmljZSI6MC4wMCwgInRyYWNrUmVu
156
+ dGFsUHJpY2UiOjAsICJjb2xsZWN0aW9uSGRQcmljZSI6MCwgInRyYWNrSGRQ
157
+ cmljZSI6MCwgInRyYWNrSGRSZW50YWxQcmljZSI6MCwgInJlbGVhc2VEYXRl
158
+ IjoiMjAxMi0xMi0yMFQxNjoyODowMFoiLCAiY29sbGVjdGlvbkV4cGxpY2l0
159
+ bmVzcyI6Im5vdEV4cGxpY2l0IiwgInRyYWNrRXhwbGljaXRuZXNzIjoibm90
160
+ RXhwbGljaXQiLCAidHJhY2tDb3VudCI6NDcsICJjb3VudHJ5IjoiVVNBIiwg
161
+ ImN1cnJlbmN5IjoiVVNEIiwgInByaW1hcnlHZW5yZU5hbWUiOiJTb2Z0d2Fy
162
+ ZSBIb3ctVG8iLCAicmFkaW9TdGF0aW9uVXJsIjoiaHR0cHM6Ly9pdHVuZXMu
163
+ YXBwbGUuY29tL3N0YXRpb24vaWRyYS4zNDcyMDc5NDUiLCAiYXJ0d29ya1Vy
164
+ bDYwMCI6Imh0dHA6Ly9hNS5tenN0YXRpYy5jb20vdXMvcjMwL1BvZGNhc3Rz
165
+ My92NC8wMy84OS9jYi8wMzg5Y2I3Yy00OWQ5LTc5YzctZWJiOC1jNjE2YWNl
166
+ OTQ3ZmUvbXphXzU3NTY4MzEwMjk5NTU0MTcwOTMuNjAweDYwMC03NS5qcGci
167
+ LCAiZ2VucmVJZHMiOlsiMTQ4MCIsICIyNiIsICIxMzE4Il0sICJnZW5yZXMi
168
+ OlsiU29mdHdhcmUgSG93LVRvIiwgIlBvZGNhc3RzIiwgIlRlY2hub2xvZ3ki
169
+ XX1dCn0KCgo=
170
+ http_version:
171
+ recorded_at: Thu, 06 Nov 2014 03:02:37 GMT
172
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Imasquerade, vcr: {
4
+ cassette_name: 'itunes',
5
+ record: :new_episodes
6
+ } do
7
+ describe '.parse_itunes_uri' do
8
+ let(:uri) { 'https://itunes.apple.com/us/podcast/wdw-radio-show-your-walt-disney/id215517191?mt=2' }
9
+ let(:expected_response) { 'http://www.wdwradio.com/xml/wdwradio.xml' }
10
+
11
+ subject(:response) { Imasquerade.parse_itunes_uri(uri) }
12
+
13
+ it 'should perform the example in the README' do
14
+ expect(response).to eq(expected_response)
15
+ end
16
+ end
17
+
18
+ describe 'issue #3' do
19
+ let(:uri) { 'http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewPodcast?id=347207945' }
20
+ let(:expected_response) { 'http://feeds.feedwrench.com/TeachMeToCodeiPhone.rss' }
21
+
22
+ subject(:response) { Imasquerade.parse_itunes_uri(uri) }
23
+
24
+ it 'should resolve the podcast in issue #3' do
25
+ expect(response).to eq(expected_response)
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,101 @@
1
+ require 'webmock/rspec'
2
+ require 'vcr'
3
+
4
+ require 'imasquerade'
5
+
6
+ # This file was generated by the `rspec --init` command. Conventionally, all
7
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
8
+ # The generated `.rspec` file contains `--require spec_helper` which will cause this
9
+ # file to always be loaded, without a need to explicitly require it in any files.
10
+ #
11
+ # Given that it is always loaded, you are encouraged to keep this file as
12
+ # light-weight as possible. Requiring heavyweight dependencies from this file
13
+ # will add to the boot time of your test suite on EVERY test run, even for an
14
+ # individual file that may not need all of that loaded. Instead, consider making
15
+ # a separate helper file that requires the additional dependencies and performs
16
+ # the additional setup, and require it from the spec files that actually need it.
17
+ #
18
+ # The `.rspec` file also contains a few flags that are not defaults but that
19
+ # users commonly want.
20
+ #
21
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
22
+ RSpec.configure do |config|
23
+ # rspec-expectations config goes here. You can use an alternate
24
+ # assertion/expectation library such as wrong or the stdlib/minitest
25
+ # assertions if you prefer.
26
+ config.expect_with :rspec do |expectations|
27
+ # This option will default to `true` in RSpec 4. It makes the `description`
28
+ # and `failure_message` of custom matchers include text for helper methods
29
+ # defined using `chain`, e.g.:
30
+ # be_bigger_than(2).and_smaller_than(4).description
31
+ # # => "be bigger than 2 and smaller than 4"
32
+ # ...rather than:
33
+ # # => "be bigger than 2"
34
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
35
+ end
36
+
37
+ # rspec-mocks config goes here. You can use an alternate test double
38
+ # library (such as bogus or mocha) by changing the `mock_with` option here.
39
+ config.mock_with :rspec do |mocks|
40
+ # Prevents you from mocking or stubbing a method that does not exist on
41
+ # a real object. This is generally recommended, and will default to
42
+ # `true` in RSpec 4.
43
+ mocks.verify_partial_doubles = true
44
+ end
45
+
46
+ # The settings below are suggested to provide a good initial experience
47
+ # with RSpec, but feel free to customize to your heart's content.
48
+ =begin
49
+ # These two settings work together to allow you to limit a spec run
50
+ # to individual examples or groups you care about by tagging them with
51
+ # `:focus` metadata. When nothing is tagged with `:focus`, all examples
52
+ # get run.
53
+ config.filter_run :focus
54
+ config.run_all_when_everything_filtered = true
55
+
56
+ # Limits the available syntax to the non-monkey patched syntax that is recommended.
57
+ # For more details, see:
58
+ # - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
59
+ # - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
60
+ # - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
61
+ config.disable_monkey_patching!
62
+
63
+ # This setting enables warnings. It's recommended, but in some cases may
64
+ # be too noisy due to issues in dependencies.
65
+ config.warnings = true
66
+
67
+ # Many RSpec users commonly either run the entire suite or an individual
68
+ # file, and it's useful to allow more verbose output when running an
69
+ # individual spec file.
70
+ if config.files_to_run.one?
71
+ # Use the documentation formatter for detailed output,
72
+ # unless a formatter has already been configured
73
+ # (e.g. via a command-line flag).
74
+ config.default_formatter = 'doc'
75
+ end
76
+
77
+ # Print the 10 slowest examples and example groups at the
78
+ # end of the spec run, to help surface which specs are running
79
+ # particularly slow.
80
+ config.profile_examples = 10
81
+
82
+ # Run specs in random order to surface order dependencies. If you find an
83
+ # order dependency and want to debug it, you can fix the order by providing
84
+ # the seed, which is printed after each run.
85
+ # --seed 1234
86
+ config.order = :random
87
+
88
+ # Seed global randomization in this process using the `--seed` CLI option.
89
+ # Setting this allows you to use `--seed` to deterministically reproduce
90
+ # test failures related to randomization by passing the same `--seed` value
91
+ # as the one that triggered the failure.
92
+ Kernel.srand config.seed
93
+ =end
94
+ end
95
+
96
+ VCR.configure do |c|
97
+ c.cassette_library_dir = 'spec/cassettes'
98
+ c.hook_into :webmock
99
+ # c.preserve_exact_body_bytes { true }
100
+ c.configure_rspec_metadata!
101
+ end
metadata CHANGED
@@ -1,112 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: imasquerade
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
5
- prerelease:
4
+ version: 0.3.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Ryan Lovelett
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-06-29 00:00:00.000000000 Z
11
+ date: 2014-11-06 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
- name: curb
14
+ name: httparty
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ! '>='
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '0'
19
+ version: 0.13.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ! '>='
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '0'
26
+ version: 0.13.0
30
27
  - !ruby/object:Gem::Dependency
31
- name: nokogiri
28
+ name: multi_json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - "~>"
36
32
  - !ruby/object:Gem::Version
37
- version: '0'
33
+ version: 1.10.0
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - "~>"
44
39
  - !ruby/object:Gem::Version
45
- version: '0'
40
+ version: 1.10.0
46
41
  - !ruby/object:Gem::Dependency
47
- name: plist
42
+ name: rake
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - "~>"
52
46
  - !ruby/object:Gem::Version
53
- version: '0'
54
- type: :runtime
47
+ version: 10.3.0
48
+ type: :development
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - "~>"
60
53
  - !ruby/object:Gem::Version
61
- version: '0'
54
+ version: 10.3.0
62
55
  - !ruby/object:Gem::Dependency
63
- name: colorize
56
+ name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ! '>='
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
- version: '0'
70
- type: :runtime
61
+ version: 3.1.0
62
+ type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ! '>='
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
- version: '0'
68
+ version: 3.1.0
78
69
  - !ruby/object:Gem::Dependency
79
- name: rake
70
+ name: vcr
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - "~>"
84
74
  - !ruby/object:Gem::Version
85
- version: '0'
75
+ version: 2.9.0
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - "~>"
92
81
  - !ruby/object:Gem::Version
93
- version: '0'
82
+ version: 2.9.0
94
83
  - !ruby/object:Gem::Dependency
95
- name: shoulda
84
+ name: webmock
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - "~>"
100
88
  - !ruby/object:Gem::Version
101
- version: '0'
89
+ version: 1.20.0
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - "~>"
108
95
  - !ruby/object:Gem::Version
109
- version: '0'
96
+ version: 1.20.0
110
97
  description: iMasquerade is a Ruby project that allows for the retrieval of the original
111
98
  XML feed used by iTunes to create a specific podcast feed. As the name suggests,
112
99
  the class works by masquerading as iTunes, thereby retrieving the same XML used
@@ -118,10 +105,12 @@ executables: []
118
105
  extensions: []
119
106
  extra_rdoc_files: []
120
107
  files:
121
- - .document
122
- - .gitignore
123
- - .rvmrc
124
- - .travis.yml
108
+ - ".document"
109
+ - ".gitignore"
110
+ - ".rspec"
111
+ - ".ruby-gemset"
112
+ - ".ruby-version"
113
+ - ".travis.yml"
125
114
  - Gemfile
126
115
  - LICENSE.txt
127
116
  - README.rdoc
@@ -130,34 +119,35 @@ files:
130
119
  - lib/imasquerade.rb
131
120
  - lib/imasquerade/extractor.rb
132
121
  - lib/imasquerade/version.rb
133
- - test/helper.rb
134
- - test/test_imasquerade.rb
122
+ - spec/cassettes/itunes.yml
123
+ - spec/imasquerade_spec.rb
124
+ - spec/spec_helper.rb
135
125
  homepage: https://github.com/RLovelett/imasquerade
136
126
  licenses:
137
127
  - MIT
128
+ metadata: {}
138
129
  post_install_message:
139
130
  rdoc_options: []
140
131
  require_paths:
141
132
  - lib
142
133
  required_ruby_version: !ruby/object:Gem::Requirement
143
- none: false
144
134
  requirements:
145
- - - ! '>='
135
+ - - ">="
146
136
  - !ruby/object:Gem::Version
147
137
  version: '0'
148
138
  required_rubygems_version: !ruby/object:Gem::Requirement
149
- none: false
150
139
  requirements:
151
- - - ! '>='
140
+ - - ">="
152
141
  - !ruby/object:Gem::Version
153
142
  version: '0'
154
143
  requirements: []
155
144
  rubyforge_project:
156
- rubygems_version: 1.8.24
145
+ rubygems_version: 2.4.2
157
146
  signing_key:
158
- specification_version: 3
147
+ specification_version: 4
159
148
  summary: iMasquerade is a Ruby class that takes an iTunes Podcast URL and outputs
160
149
  the XML feed URL.
161
150
  test_files:
162
- - test/helper.rb
163
- - test/test_imasquerade.rb
151
+ - spec/cassettes/itunes.yml
152
+ - spec/imasquerade_spec.rb
153
+ - spec/spec_helper.rb
data/.rvmrc DELETED
@@ -1,49 +0,0 @@
1
- #!/usr/bin/env bash
2
-
3
- # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
- # development environment upon cd'ing into the directory
5
-
6
- # First we specify our desired <ruby>[@<gemset>], the @gemset name is optional.
7
- environment_id="ruby-1.9.3@imasquerade"
8
-
9
- #
10
- # First we attempt to load the desired environment directly from the environment
11
- # file. This is very fast and efficicent compared to running through the entire
12
- # CLI and selector. If you want feedback on which environment was used then
13
- # insert the word 'use' after --create as this triggers verbose mode.
14
- #
15
- if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
16
- && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]] ; then
17
- \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
18
-
19
- [[ -s ".rvm/hooks/after_use" ]] && . ".rvm/hooks/after_use"
20
- else
21
- # If the environment file has not yet been created, use the RVM CLI to select.
22
- rvm --create use "$environment_id"
23
- fi
24
-
25
- #
26
- # If you use an RVM gemset file to install a list of gems (*.gems), you can have
27
- # it be automatically loaded. Uncomment the following and adjust the filename if
28
- # necessary.
29
- #
30
- # filename=".gems"
31
- # if [[ -s "$filename" ]] ; then
32
- # rvm gemset import "$filename" | grep -v already | grep -v listed | grep -v complete | sed '/^$/d'
33
- # fi
34
-
35
- #
36
- # If you use bundler and would like to run bundle each time you enter the
37
- # directory, you can uncomment the following code.
38
- #
39
- # # Ensure that Bundler is installed. Install it if it is not.
40
- # if ! command -v bundle >/dev/null; then
41
- # printf "The rubygem 'bundler' is not installed. Installing it now.\n"
42
- # gem install bundler
43
- # fi
44
- #
45
- # # Bundle while reducing excess noise.
46
- # printf "Bundling your gems. This may take a few minutes on a fresh clone.\n"
47
- # bundle | grep -v '^Using ' | grep -v ' is complete' | sed '/^$/d'
48
- #
49
-
@@ -1,18 +0,0 @@
1
- require 'rubygems'
2
- require 'bundler'
3
- begin
4
- Bundler.setup(:default, :development)
5
- rescue Bundler::BundlerError => e
6
- $stderr.puts e.message
7
- $stderr.puts "Run `bundle install` to install missing gems"
8
- exit e.status_code
9
- end
10
- require 'test/unit'
11
- require 'shoulda'
12
-
13
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
- $LOAD_PATH.unshift(File.dirname(__FILE__))
15
- require 'imasquerade'
16
-
17
- class Test::Unit::TestCase
18
- end
@@ -1,10 +0,0 @@
1
- require 'helper'
2
-
3
- class TestImasquerade < Test::Unit::TestCase
4
- should "perform the example in the README" do
5
- uri = "http://itunes.apple.com/us/podcast/the-f-u-sports-talk-podcast/id356478903"
6
- proper_response = "http://www.urannonline.com/Collection_Site/The_F_U_Sports_Talk_Podcast/rss.xml"
7
- response = Imasquerade::Extractor.parse_itunes_uri uri
8
- assert_equal(proper_response, response)
9
- end
10
- end