restpack_serializer 0.2.4 → 0.2.5

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWIyZmNmYzJlMmY3NmNkMWNmZTc3ZjcxZWExMjMyNWE4N2EzNTNmOQ==
4
+ YmViZmMyYTk0YTVhZDY0YTczMGQ4MDIwMThjZjNhMDBhZmFmMWZlOA==
5
5
  data.tar.gz: !binary |-
6
- MDM5M2RmY2Q1Nzc0ZGJkYjVmMDBkYmZlOTcyYWZjMTg0MjRjMjEwZA==
6
+ YmEzNGY0ZDU2Y2Y3ZTI1OTkyNzBhYmVhMmU0NzIxNGRjYmJjNTNmYg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- YzNlMTM4MzFjMTE5ZTY5NWVhMzEwNTQ4ZTg0MDU3MjBkNTk2MzVjZWNmNTA5
10
- NDNjNzE2ZjE0MGI0Y2ZhMDhlZGJhOTc2NzQzNDZlZGM0MjYzNjhlYTM3NGRk
11
- NTk1ODQ2ZDFmYTBiZmIwMWZhYjdhNjc1Y2IzYjI5ZjUyYmIwYzA=
9
+ YjMyYTgyOWJmZTc4NDBlYmY4OGZiMDljMzFlZjQ0ZTM5MmYzNjUwMjkxZWVj
10
+ ZWE0YjNhMjUzYzlmYTBlZmQ5OWNlYjBiMmY5NzRkNTI0MDg5MTNhMmZmNWM3
11
+ NGI1OWFkOWRhZTU3YzZkOWQ2N2JlNWVjMGNjMjhiYzVhMjQ2MjQ=
12
12
  data.tar.gz: !binary |-
13
- ODY3ZTI0NGFkMTlkZTQ0OWZlNDZkMTBmZWYzMDQ2ZTIzYWQyYWExNTY0YjAy
14
- NjI2ZmUwOTMzZTkwNWI3MDVhZjVlOTlhNGFlNTU3MmViNGU1ODIyMDQ4MWEy
15
- N2ViYjNkZDE3ZDY4NjE2MWY4YmZmMGQ2OWMzZjc4NTZjNDUxZGY=
13
+ YTRlMGZkMTAwZjM1YzZhODI4NjdmNGIwMTdhMzY2YTcwZDg4NjAyNWM2MmYy
14
+ ODEzMTUyNTEzOTkwZmQ5MzE4OGUwOTFlNzZjZmRiNDlmN2Y1YjIwMzUxODM3
15
+ Y2ZiZTJkNjgyOTA1ZWI2NjAxODk4MzZiZDVhZDk0NTY0ZDQ2MDg=
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- restpack_serializer (0.2.4)
4
+ restpack_serializer (0.2.5)
5
5
  activerecord (>= 3.0)
6
6
  activesupport (>= 3.0)
7
7
  will_paginate (~> 3.0)
@@ -4,3 +4,11 @@ require 'will_paginate/active_record'
4
4
  require 'restpack_serializer/version'
5
5
  require 'restpack_serializer/serializable'
6
6
  require 'restpack_serializer/factory'
7
+
8
+ module RestPack
9
+ module Serializer
10
+ mattr_accessor :href_prefix
11
+
12
+ @@href_prefix = ''
13
+ end
14
+ end
@@ -45,7 +45,7 @@ module RestPack::Serializer::SideLoading
45
45
  end
46
46
 
47
47
  links[link_key] = {
48
- :href => href,
48
+ :href => RestPack::Serializer.href_prefix + href,
49
49
  :type => association.plural_name.to_sym
50
50
  }
51
51
  end
@@ -1,5 +1,5 @@
1
1
  module RestPack
2
2
  module Serializer
3
- VERSION = '0.2.4'
3
+ VERSION = '0.2.5'
4
4
  end
5
5
  end
@@ -60,6 +60,13 @@ describe RestPack::Serializer::SideLoading do
60
60
  :type => :songs
61
61
  }
62
62
  }
63
+
64
+ it "applies custom RestPack::Serializer.href_prefix" do
65
+ original = RestPack::Serializer.href_prefix
66
+ RestPack::Serializer.href_prefix = "/api/v1"
67
+ AlbumSerializer.links["albums.artist"][:href].should == "/api/v1/artists/{albums.artist}.json"
68
+ RestPack::Serializer.href_prefix = original
69
+ end
63
70
  end
64
71
 
65
72
  describe "#filterable_by" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restpack_serializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gavin Joyce