songdrop 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/songdrop/parser.rb +11 -4
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a0bd465f684b3c3b09208e33344c8e68ed8d6a91
4
- data.tar.gz: e8f950ada2237038cdaa55606661987044d678d8
3
+ metadata.gz: 24ca24af6310be5399a5ce9d2dd46354addf2d92
4
+ data.tar.gz: 8ac956ec193d3d1f417d397820ef518a23aebde0
5
5
  SHA512:
6
- metadata.gz: e6b28352f219775f47a516d9f2cd6c6a2cfa3e874fd5f0845695d6bd86db93733aa471543f582facf431701a78bcca49635e17dc62b1ce7f72fdb37100e1c1ba
7
- data.tar.gz: 113cd38dfb35db28da6ee9ccde51d251861c86f32745190c383860cb75b3315d9ebb9585dd80fd8d128dc894390ea15e7ae685e34566b9df64589b063f4d38e1
6
+ metadata.gz: d9ea82042009ba424e9632fe74488d8e7d2bce3eb502268e6335ec133f65d99790562c2b2bb3db5a9bb2a24d0d9025bc49d123613bf7f12f9befcf37b5465cb8
7
+ data.tar.gz: 1e19ff1b52301f906621252f7ce2769b1a431f19a2e16730b8624c0044c10a3d38d8f993da630e648fe67dd48da1adda6774d5c286a5656754baf149ed50fb60
@@ -6,20 +6,20 @@ module Songdrop
6
6
  if response.is_a?(Hash) and response['object']
7
7
 
8
8
  # we only got one object back
9
- return objectize(response['object'], parse_object(response))
9
+ return objectize(response['object'], parse_object(response, headers))
10
10
 
11
11
  elsif response.is_a?(Hash)
12
12
 
13
13
  # we got a hash pointer to objects
14
14
  return response.keys.collect do |object|
15
- objectize(object, parse_object(response[object]))
15
+ objectize(object, parse_object(response[object], headers))
16
16
  end
17
17
 
18
18
  elsif response.is_a? Array
19
19
 
20
20
  # we got an array of objects back
21
21
  result = response.collect do |object|
22
- properties = parse_object(object)
22
+ properties = parse_object(object, headers)
23
23
  objectize(object['object'], properties)
24
24
  end
25
25
 
@@ -37,7 +37,7 @@ module Songdrop
37
37
  end
38
38
  end
39
39
 
40
- def self.parse_object(hash)
40
+ def self.parse_object(hash, headers={})
41
41
  # puts "[Songdrop::Parser] PARSE #{hash.inspect}"
42
42
  properties = {}
43
43
 
@@ -49,6 +49,13 @@ module Songdrop
49
49
  hash[property].each do |el|
50
50
  objects << objectize(el['object'], parse_object(el))
51
51
  end
52
+
53
+ pagination = JSON.parse(headers[:x_pagination]) if headers[:x_pagination]
54
+ if pagination and pagination['element'] == property
55
+ collection = Collection.new(pagination)
56
+ objects = collection.replace(objects)
57
+ end
58
+
52
59
  properties[property.to_sym] = objects
53
60
  elsif hash[property].is_a?(Hash) and hash[property]['object']
54
61
  # puts "[Songdrop::Parser] parsing hash #{property} of type #{hash[property]['object']}"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: songdrop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-21 00:00:00.000000000 Z
11
+ date: 2013-07-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: songdrop is a Ruby & RubyMotion client for the Songdrop.com API.
14
14
  email: moomerman@gmail.com