itunes 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/README.md +11 -9
- data/itunes.gemspec +7 -9
- data/lib/itunes.rb +11 -6
- data/lib/itunes/client/lookup.rb +40 -3
- data/lib/itunes/client/search.rb +28 -14
- data/lib/itunes/request.rb +3 -3
- data/lib/itunes/version.rb +1 -1
- data/spec/fixtures/ITunes_Client.yml +1113 -512
- data/spec/itunes/client_spec.rb +75 -47
- data/spec/itunes_spec.rb +17 -2
- metadata +17 -117
- data/lib/faraday/rashify.rb +0 -30
- data/spec/faraday/rashify_spec.rb +0 -17
- data/spec/fixtures/Faraday_Response_Rashify.yml +0 -46
data/lib/faraday/rashify.rb
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'faraday'
|
2
|
-
|
3
|
-
# @private
|
4
|
-
module Faraday
|
5
|
-
# @private
|
6
|
-
class Response::Rashify < Response::Middleware
|
7
|
-
begin
|
8
|
-
require 'hashie'
|
9
|
-
require 'rash'
|
10
|
-
rescue LoadError, NameError => error
|
11
|
-
self.load_error = error
|
12
|
-
end
|
13
|
-
|
14
|
-
def self.register_on_complete(env)
|
15
|
-
env[:response].on_complete do |response|
|
16
|
-
response_body = response[:body]
|
17
|
-
if response_body.is_a?(Hash)
|
18
|
-
response[:body] = ::Hashie::Rash.new(response_body)
|
19
|
-
elsif response_body.is_a?(Array)
|
20
|
-
response[:body] = response_body.map{|item| item.is_a?(Hash) ? ::Hashie::Rash.new(item) : item}
|
21
|
-
end
|
22
|
-
end
|
23
|
-
end
|
24
|
-
|
25
|
-
def initialize(app)
|
26
|
-
super
|
27
|
-
@parser = nil
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
require File.expand_path('../../../lib/faraday/rashify', __FILE__)
|
4
|
-
|
5
|
-
describe Faraday::Response::Rashify do
|
6
|
-
|
7
|
-
use_vcr_cassette :record => :new_episodes, :match_requests_on => [:uri, :method]
|
8
|
-
|
9
|
-
describe "converting camelcase keys to underscores" do
|
10
|
-
it "should respond with a hashie mash with underscored keys" do
|
11
|
-
response = ITunes.lookup('358735381')
|
12
|
-
response.respond_to?(:result_count).should be_true
|
13
|
-
response.results.first.respond_to?(:wrapper_type).should be_true
|
14
|
-
response.results.first.respond_to?(:collection_type).should be_true
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,46 +0,0 @@
|
|
1
|
-
---
|
2
|
-
- !ruby/struct:VCR::HTTPInteraction
|
3
|
-
request: !ruby/struct:VCR::Request
|
4
|
-
method: :get
|
5
|
-
uri: http://ax.itunes.apple.com:80/WebObjects/MZStoreServices.woa/wa/wsLookup?id=358735381
|
6
|
-
body:
|
7
|
-
headers:
|
8
|
-
response: !ruby/struct:VCR::Response
|
9
|
-
status: !ruby/struct:VCR::ResponseStatus
|
10
|
-
code: 200
|
11
|
-
message: OK
|
12
|
-
headers:
|
13
|
-
x-apple-orig-url-path:
|
14
|
-
- /WebObjects/MZStoreServices.woa/wa/wsLookup?id=358735381
|
15
|
-
x-apple-application-site:
|
16
|
-
- NWK
|
17
|
-
x-apple-max-age:
|
18
|
-
- "3600"
|
19
|
-
x-apple-woa-inbound-url:
|
20
|
-
- /WebObjects/MZStoreServices.woa/wa/wsLookup?id=358735381
|
21
|
-
content-type:
|
22
|
-
- text/javascript; charset=utf-8
|
23
|
-
x-apple-application-instance:
|
24
|
-
- "12032"
|
25
|
-
x-webobjects-loadaverage:
|
26
|
-
- "0"
|
27
|
-
vary:
|
28
|
-
- X-Apple-Store-Front
|
29
|
-
- X-Apple-Store-Front
|
30
|
-
expires:
|
31
|
-
- Mon, 31 Jan 2011 05:43:58 GMT
|
32
|
-
cache-control:
|
33
|
-
- max-age=0, no-cache
|
34
|
-
pragma:
|
35
|
-
- no-cache
|
36
|
-
date:
|
37
|
-
- Mon, 31 Jan 2011 05:43:58 GMT
|
38
|
-
content-length:
|
39
|
-
- "912"
|
40
|
-
x-apple-partner:
|
41
|
-
- origin.0
|
42
|
-
body: "\n\n\n\
|
43
|
-
{\n \"resultCount\":1,\n \"results\": [\n\
|
44
|
-
{\"wrapperType\":\"collection\", \"collectionType\":\"Album\", \"artistId\":220276686, \"collectionId\":358735381, \"amgArtistId\":1045698, \"amgVideoArtistId\":null, \"artistName\":\"Scuba\", \"collectionName\":\"Triangulation\", \"collectionCensoredName\":\"Triangulation\", \"artistViewUrl\":\"http://itunes.apple.com/us/artist/scuba/id220276686?uo=4\", \"collectionViewUrl\":\"http://itunes.apple.com/us/album/triangulation/id358735381?uo=4\", \"artworkUrl60\":\"http://a1.phobos.apple.com/us/r1000/054/Music/65/35/f0/mzi.lpsdgrjd.60x60-50.jpg\", \"artworkUrl100\":\"http://a1.phobos.apple.com/us/r1000/054/Music/65/35/f0/mzi.lpsdgrjd.100x100-75.jpg\", \"collectionPrice\":9.99, \"collectionExplicitness\":\"notExplicit\", \"contentAdvisoryRating\":null, \"trackCount\":13, \"copyright\":\"2010 Hotflush Recordings\", \"country\":\"USA\", \"currency\":\"USD\", \"releaseDate\":\"2010-03-22T07:00:00Z\", \"primaryGenreName\":\"Electronic\"}]\n\
|
45
|
-
}\n\n\n"
|
46
|
-
http_version: "1.1"
|