plate_api 1.1.2 → 1.1.3
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 +2 -2
- data/lib/plate_api/plate_object/base.rb +7 -3
- data/lib/plate_api/plate_object/section.rb +1 -0
- data/lib/plate_api/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 12543bd75be711cc9504fc30e5b0508b2df7b747fa747dc3cc9734bd1256680f
|
4
|
+
data.tar.gz: 61a3bd8e84449f85d3267148af9df1e266ec4a42715b067c2e23edc8b9803934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
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.
|
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[
|
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"
|
data/lib/plate_api/version.rb
CHANGED