xing-backend 0.0.14 → 0.0.15

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 74175fddf1215ed94724354b57fcc40ece2d292e
4
- data.tar.gz: e05dd42fd8d0b1cac13b84a99da52d9f5c225413
3
+ metadata.gz: 5e301f87885106f58a5f2043851f10c655edee78
4
+ data.tar.gz: 2dc422d430a4d8b3a045c5b8a4e3f73e98641b96
5
5
  SHA512:
6
- metadata.gz: c927c8307144a1d5727d786f6ba4659cebb6a84197295682ba942eca3e063a612a4f5dd2b2619454a830c879f7e59508961ccfee22c13f1381d24d0a81737537
7
- data.tar.gz: 634f88679c1c9430cfebef12caac13c829aeb0eb5680f5c3096f2c828f1949f606c54fbcef5e8e9333b7967d95e1e8edde5c634065f509f06da00f60b90da2c6
6
+ metadata.gz: 1924eaa6084d7980ae7a170fb4d7950edec2603310ea5ee63449ab249722ffb2683374e13397239264bd496641f4d25cbbaa5091e54024057ad7deed166604a8
7
+ data.tar.gz: 5f826cad426d488928613e136029dd70c77e8f0085ba9b0f3be4b463161ad42c354558e3bfd780f2a9d06f2c454873e581525eabd9e8bc38a90e56f1ba983d3d
@@ -3,6 +3,7 @@ require 'xing/services/locator'
3
3
  module Xing
4
4
  module Builders
5
5
  class ListDifferenceBuilder
6
+ include Services::Locator
6
7
 
7
8
  # list_data is is an array of JSON objects passed in by the mapper (the new list of records)
8
9
  # collection is the ActiveRecord collection of existing records (i.e. person.pets, rainbow.colors, book.chapters)
@@ -8,6 +8,7 @@ require 'xing/services/locator'
8
8
  module Xing
9
9
  module Mappers
10
10
  class Base
11
+ include Services::Locator
11
12
  class MissingLinkException < Exception; end
12
13
 
13
14
  # Subclasses must define:
@@ -40,34 +41,10 @@ module Xing
40
41
  attr_writer :record
41
42
  attr_reader :links
42
43
 
43
- def locator_attribute_name
44
+ def self.locator_attribute_name
44
45
  :id
45
46
  end
46
47
 
47
- def router
48
- Rails.application.routes
49
- end
50
-
51
- def normalize_path(path)
52
- path = "/#{path}"
53
- path.squeeze!('/')
54
- path.sub!(%r{/+\Z}, '')
55
- path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
56
- path = '/' if path == ''
57
- path
58
- end
59
-
60
- # This helper is used to deconstruct a URL for the purpose of extracting
61
- # components. For example, menu_item_mapper uses it to extract the url_slug
62
- # component of a page route. We are here abusing recognize_path, which isn't
63
- # supposed to be used outside of tests (see
64
- # https://github.com/rails/rails/issues/2656), but we don't know what the
65
- # alternative is.e
66
- def route_to(path)
67
- path = "http://#{BACKEND_SUBDOMAIN}.example.com#{normalize_path(path)}";
68
- router.recognize_path(path)
69
- end
70
-
71
48
  # Default save - subclasses might override
72
49
  def save
73
50
  perform_mapping
@@ -100,7 +77,7 @@ module Xing
100
77
  end
101
78
 
102
79
  def unwrap_links(hash)
103
- hash['links'].with_indifferent_access
80
+ hash['links'].with_indifferent_access if hash['links']
104
81
  end
105
82
 
106
83
  def unwrap_data(hash)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xing-backend
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.14
4
+ version: 0.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Dorn
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-06-26 00:00:00.000000000 Z
14
+ date: 2015-06-29 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rails
@@ -208,7 +208,7 @@ rdoc_options:
208
208
  - "--main"
209
209
  - doc/README
210
210
  - "--title"
211
- - xing-backend-0.0.14 Documentation
211
+ - xing-backend-0.0.15 Documentation
212
212
  require_paths:
213
213
  - lib/
214
214
  required_ruby_version: !ruby/object:Gem::Requirement