freesound_ruby 0.1.0 → 0.1.1
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/freesound/resources.rb +12 -0
- data/lib/freesound/version.rb +1 -1
- data/spec/integration/find_sound_spec.rb +4 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e48a9bb294fc73104a0fd5187168e0a0b200c6e
|
4
|
+
data.tar.gz: 8be2c865036aae3e5c89f3ff48a379558910da58
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3077e7781c0ab4bd53966e7fa17dd85e4bf59df6bca640611cd639cdcf486b7edbcb22aaf1f090b39cc7cfeb544e055e07ecf76931e6d4a516f4249caaf14f
|
7
|
+
data.tar.gz: eb1f0d7763a28f6fcfac54c3c5db65def2bb5bfe1525f107ae327799ea86455c3d640a67ba49c6b609bef1343df2866a6fb85d93ec660d509f80185fffd504d6
|
data/Gemfile.lock
CHANGED
data/lib/freesound/resources.rb
CHANGED
@@ -59,6 +59,18 @@ module Freesound
|
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
|
+
# Certain resource attributes contain dashes rather than underscores.
|
63
|
+
# This override allows resources with attributes like "preview-hq-mp3" to
|
64
|
+
# respond to "preview_hq_mp3" instead.
|
65
|
+
#
|
66
|
+
def initialize(attributes={}, *args)
|
67
|
+
underscored = attributes.inject({}) do |acc, (attr, value)|
|
68
|
+
acc.merge(attr.to_s.underscore => value)
|
69
|
+
end
|
70
|
+
|
71
|
+
super(underscored, *args)
|
72
|
+
end
|
73
|
+
|
62
74
|
private
|
63
75
|
|
64
76
|
def query_params(additional={})
|
data/lib/freesound/version.rb
CHANGED
@@ -16,6 +16,10 @@ describe "finding a sound" do
|
|
16
16
|
expect(sound.tags).to respond_to(:to_ary)
|
17
17
|
end
|
18
18
|
|
19
|
+
it "transforms dashified attributes to underscores" do
|
20
|
+
expect(sound.preview_hq_mp3).to respond_to(:to_str)
|
21
|
+
end
|
22
|
+
|
19
23
|
it "belongs to a user" do
|
20
24
|
expect(sound.user.username).to be_present
|
21
25
|
end
|