freemusicarchive 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,78 @@
1
+ require File.expand_path('../spec_helper', __FILE__)
2
+
3
+ describe FreeMusicArchive do
4
+ after do
5
+ FreeMusicArchive.reset
6
+ end
7
+
8
+ describe ".client" do
9
+ it "should be a FreeMusicArchive::Client" do
10
+ FreeMusicArchive.client.should be_a FreeMusicArchive::Client
11
+ end
12
+ end
13
+
14
+ describe ".adapter" do
15
+ it "should return the default adapter" do
16
+ FreeMusicArchive.adapter.should == FreeMusicArchive::Configuration::DEFAULT_ADAPTER
17
+ end
18
+ end
19
+
20
+ describe ".adapter=" do
21
+ it "should set the adapter" do
22
+ FreeMusicArchive.adapter = :typhoeus
23
+ FreeMusicArchive.adapter.should == :typhoeus
24
+ end
25
+ end
26
+
27
+ describe ".endpoint" do
28
+ it "should return the default endpoint" do
29
+ FreeMusicArchive.endpoint.should == FreeMusicArchive::Configuration::DEFAULT_ENDPOINT
30
+ end
31
+ end
32
+
33
+ describe ".endpoint=" do
34
+ it "should set the endpoint" do
35
+ FreeMusicArchive.endpoint = 'http://twitter.com'
36
+ FreeMusicArchive.endpoint.should == 'http://twitter.com'
37
+ end
38
+ end
39
+
40
+ describe ".format" do
41
+ it "should return the default format" do
42
+ FreeMusicArchive.format.should == FreeMusicArchive::Configuration::DEFAULT_FORMAT
43
+ end
44
+ end
45
+
46
+ describe ".format=" do
47
+ it "should set the format" do
48
+ FreeMusicArchive.format = 'json'
49
+ FreeMusicArchive.format.should == 'json'
50
+ end
51
+ end
52
+
53
+ describe ".user_agent" do
54
+ it "should return the default user agent" do
55
+ FreeMusicArchive.user_agent.should == FreeMusicArchive::Configuration::DEFAULT_USER_AGENT
56
+ end
57
+ end
58
+
59
+ describe ".user_agent=" do
60
+ it "should set the user_agent" do
61
+ FreeMusicArchive.user_agent = 'Custom User Agent'
62
+ FreeMusicArchive.user_agent.should == 'Custom User Agent'
63
+ end
64
+ end
65
+
66
+ describe ".configure" do
67
+
68
+ FreeMusicArchive::Configuration::VALID_OPTIONS_KEYS.each do |key|
69
+
70
+ it "should set the #{key}" do
71
+ FreeMusicArchive.configure do |config|
72
+ config.send("#{key}=", key)
73
+ FreeMusicArchive.send(key).should == key
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,44 @@
1
+ require 'freemusicarchive'
2
+
3
+ require 'rspec'
4
+ require 'webmock/rspec'
5
+
6
+ def a_delete(path, endpoint=FreeMusicArchive.endpoint)
7
+ a_request(:delete, endpoint + path)
8
+ end
9
+
10
+ def a_get(path, endpoint=FreeMusicArchive.endpoint)
11
+ a_request(:get, endpoint + path)
12
+ end
13
+
14
+ def a_post(path, endpoint=FreeMusicArchive.endpoint)
15
+ a_request(:post, endpoint + path)
16
+ end
17
+
18
+ def a_put(path, endpoint=FreeMusicArchive.endpoint)
19
+ a_request(:put, endpoint + path)
20
+ end
21
+
22
+ def stub_delete(path, endpoint=FreeMusicArchive.endpoint)
23
+ stub_request(:delete, endpoint + path)
24
+ end
25
+
26
+ def stub_get(path, endpoint=FreeMusicArchive.endpoint)
27
+ stub_request(:get, endpoint + path)
28
+ end
29
+
30
+ def stub_post(path, endpoint=FreeMusicArchive.endpoint)
31
+ stub_request(:post, endpoint + path)
32
+ end
33
+
34
+ def stub_put(path, endpoint=FreeMusicArchive.endpoint)
35
+ stub_request(:put, endpoint + path)
36
+ end
37
+
38
+ def fixture_path
39
+ File.expand_path("../fixtures", __FILE__)
40
+ end
41
+
42
+ def fixture(file)
43
+ File.new(fixture_path + '/' + file)
44
+ end
metadata ADDED
@@ -0,0 +1,171 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: freemusicarchive
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Liane Nakamura
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-04-20 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: faraday
16
+ requirement: &2156268820 !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ~>
20
+ - !ruby/object:Gem::Version
21
+ version: '0.7'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: *2156268820
25
+ - !ruby/object:Gem::Dependency
26
+ name: faraday_middleware
27
+ requirement: &2156268220 !ruby/object:Gem::Requirement
28
+ none: false
29
+ requirements:
30
+ - - ~>
31
+ - !ruby/object:Gem::Version
32
+ version: '0.8'
33
+ type: :runtime
34
+ prerelease: false
35
+ version_requirements: *2156268220
36
+ - !ruby/object:Gem::Dependency
37
+ name: hashie
38
+ requirement: &2156267660 !ruby/object:Gem::Requirement
39
+ none: false
40
+ requirements:
41
+ - - ! '>='
42
+ - !ruby/object:Gem::Version
43
+ version: 0.4.0
44
+ type: :runtime
45
+ prerelease: false
46
+ version_requirements: *2156267660
47
+ - !ruby/object:Gem::Dependency
48
+ name: multi_xml
49
+ requirement: &2156267080 !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: 0.4.4
55
+ type: :runtime
56
+ prerelease: false
57
+ version_requirements: *2156267080
58
+ - !ruby/object:Gem::Dependency
59
+ name: rake
60
+ requirement: &2156266440 !ruby/object:Gem::Requirement
61
+ none: false
62
+ requirements:
63
+ - - ! '>='
64
+ - !ruby/object:Gem::Version
65
+ version: '0'
66
+ type: :development
67
+ prerelease: false
68
+ version_requirements: *2156266440
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: &2156265860 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ! '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: *2156265860
80
+ - !ruby/object:Gem::Dependency
81
+ name: webmock
82
+ requirement: &2156265140 !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ~>
86
+ - !ruby/object:Gem::Version
87
+ version: '1.6'
88
+ type: :development
89
+ prerelease: false
90
+ version_requirements: *2156265140
91
+ description: A ruby wrapper for the Free Music Archive API
92
+ email:
93
+ - idiofox555+github@gmail.com
94
+ executables: []
95
+ extensions: []
96
+ extra_rdoc_files: []
97
+ files:
98
+ - .gitignore
99
+ - Gemfile
100
+ - LICENSE
101
+ - README.md
102
+ - Rakefile
103
+ - freemusicarchive.gemspec
104
+ - lib/faraday/raise_http_exception.rb
105
+ - lib/freemusicarchive.rb
106
+ - lib/freemusicarchive/client.rb
107
+ - lib/freemusicarchive/client/albums.rb
108
+ - lib/freemusicarchive/client/artists.rb
109
+ - lib/freemusicarchive/client/curators.rb
110
+ - lib/freemusicarchive/client/genres.rb
111
+ - lib/freemusicarchive/client/tracks.rb
112
+ - lib/freemusicarchive/configuration.rb
113
+ - lib/freemusicarchive/error.rb
114
+ - lib/freemusicarchive/request.rb
115
+ - lib/freemusicarchive/version.rb
116
+ - spec/fixtures/albums.xml
117
+ - spec/fixtures/albums_by_artist.xml
118
+ - spec/fixtures/artists.xml
119
+ - spec/fixtures/curators.xml
120
+ - spec/fixtures/genres.xml
121
+ - spec/fixtures/tracks.xml
122
+ - spec/fixtures/tracks_by_artist.xml
123
+ - spec/freemusicarchive/client/albums_spec.rb
124
+ - spec/freemusicarchive/client/artists_spec.rb
125
+ - spec/freemusicarchive/client/curators_spec.rb
126
+ - spec/freemusicarchive/client/genres_spec.rb
127
+ - spec/freemusicarchive/client/tracks_spec.rb
128
+ - spec/freemusicarchive/client_spec.rb
129
+ - spec/freemusicarchive_spec.rb
130
+ - spec/spec_helper.rb
131
+ homepage: ''
132
+ licenses: []
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ none: false
139
+ requirements:
140
+ - - ! '>='
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ required_rubygems_version: !ruby/object:Gem::Requirement
144
+ none: false
145
+ requirements:
146
+ - - ! '>='
147
+ - !ruby/object:Gem::Version
148
+ version: '0'
149
+ requirements: []
150
+ rubyforge_project:
151
+ rubygems_version: 1.8.12
152
+ signing_key:
153
+ specification_version: 3
154
+ summary: The freemusicarchive gem is a wrapper for the Free Music Archive API. It
155
+ provides simple methods to execute HTTP calls.
156
+ test_files:
157
+ - spec/fixtures/albums.xml
158
+ - spec/fixtures/albums_by_artist.xml
159
+ - spec/fixtures/artists.xml
160
+ - spec/fixtures/curators.xml
161
+ - spec/fixtures/genres.xml
162
+ - spec/fixtures/tracks.xml
163
+ - spec/fixtures/tracks_by_artist.xml
164
+ - spec/freemusicarchive/client/albums_spec.rb
165
+ - spec/freemusicarchive/client/artists_spec.rb
166
+ - spec/freemusicarchive/client/curators_spec.rb
167
+ - spec/freemusicarchive/client/genres_spec.rb
168
+ - spec/freemusicarchive/client/tracks_spec.rb
169
+ - spec/freemusicarchive/client_spec.rb
170
+ - spec/freemusicarchive_spec.rb
171
+ - spec/spec_helper.rb