plate_api 1.1.2 → 1.1.3

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
  SHA256:
3
- metadata.gz: 522a7eca99fa4cbfe69b6c62e3b3dcc1af33a89344eb807b5623d6c8c7095d27
4
- data.tar.gz: 3790ba562e95a4519ec147c246f4a7b7b2bc6a246aa8aff221dee434b3be1326
3
+ metadata.gz: 12543bd75be711cc9504fc30e5b0508b2df7b747fa747dc3cc9734bd1256680f
4
+ data.tar.gz: 61a3bd8e84449f85d3267148af9df1e266ec4a42715b067c2e23edc8b9803934
5
5
  SHA512:
6
- metadata.gz: 3eab81c7024b5d115aaa8c5cbb48287fb90c6af13fa04f0b2619c22027e2c1ccd24ef1d66eaba19b76d4240abfd57c71b05a87ef7b15889043757768f5ce61d0
7
- data.tar.gz: 318db8f1736f4a9896665b24a16db630e0b31d9f2f4bce96fd4384d780d5fd328608ec1fd0851dd491ee5f1a7fc768b17f1d303e69228da817e859a3a82743e5
6
+ metadata.gz: 6619d24f19edda24a7bef15a6fc7afb6d55c9c41e07f19127b875e394a6adb4741ab42a9b8144c7872e98343b158c0d97b9d1412fe4d6301684079f3e14aacab
7
+ data.tar.gz: c45aea052a41bcd8286670e68e535b3c84813ec411ea8577e9343eefff667d4d1cdebe8e32f9027156753a84b2f3118bed7f9dda016cdb95e2b492e6e337eecb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- plate_api (1.1.2)
4
+ plate_api (1.1.3)
5
5
  faraday (~> 0.15.4)
6
6
  faraday_middleware (~> 0.13.1)
7
7
  mimemagic (~> 0.3.3)
@@ -36,7 +36,7 @@ GEM
36
36
  json (2.1.0)
37
37
  mimemagic (0.3.3)
38
38
  minitest (5.11.3)
39
- multipart-post (2.0.0)
39
+ multipart-post (2.1.1)
40
40
  public_suffix (3.0.3)
41
41
  rake (10.5.0)
42
42
  rspec (3.8.0)
@@ -73,8 +73,9 @@ module PlateApi::PlateObject
73
73
  end
74
74
 
75
75
  def self.has_one(name, klass)
76
+ HasOneRelations[self.name] ||= {}
76
77
  self.attr_accessor "#{name}_id"
77
- HasOneRelations[name.to_s] = klass
78
+ HasOneRelations[self.name][name.to_s] = klass
78
79
  define_has_one_method(name, klass)
79
80
  end
80
81
 
@@ -87,7 +88,8 @@ module PlateApi::PlateObject
87
88
  end
88
89
 
89
90
  def self.has_many(plural_name, singular_name, klass, define_create_method=false)
90
- HasManyRelations[plural_name.to_s] = klass
91
+ HasManyRelations[self.name] ||= {}
92
+ HasManyRelations[self.name][plural_name.to_s] = klass
91
93
  define_has_many_methods(plural_name, klass)
92
94
  define_create_method(singular_name, klass) if define_create_method
93
95
  end
@@ -113,8 +115,10 @@ module PlateApi::PlateObject
113
115
  end
114
116
 
115
117
  def set_relation_ids(relations_attributes)
118
+ HasOneRelations[self.class.name] ||= {}
119
+
116
120
  return unless relations_attributes
117
- self.class::HasOneRelations.keys.each do |relation_name|
121
+ self.class::HasOneRelations[self.class.name].keys.each do |relation_name|
118
122
  val = relations_attributes["#{relation_name}_id"]
119
123
  if val
120
124
  send("#{relation_name}_id=", val)
@@ -2,6 +2,7 @@ module PlateApi::PlateObject
2
2
  class Section < Base
3
3
 
4
4
  has_one :post, "PlateApi::PlateObject::Post"
5
+ has_one :site_translation, "PlateApi::PlateObject::SiteTranslation"
5
6
  has_many :rows, :row, "PlateApi::PlateObject::Row", true
6
7
  has_many :columns, :column, "PlateApi::PlateObject::Column"
7
8
  has_many :elements, :element, "PlateApi::PlateObject::Element"
@@ -1,3 +1,3 @@
1
1
  module PlateApi
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: plate_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Kortleven