rest_framework 0.1.1 → 0.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: 7cb7ba6d5e7861525dca18f908afa1f398f614af654223ac03de15f7014dafaa
4
- data.tar.gz: 7938b5b0225e089f2cd3a168b80763ebcc63dd65655ae4c87b045e923477191a
3
+ metadata.gz: 96d6394bfb8dee90ee31a05289a86db5409a118a3d456b9bf927397ceea055a7
4
+ data.tar.gz: 6dc5181f02dafae6d0831a7802480375097836eb3e3e799c78076d0331a2f728
5
5
  SHA512:
6
- metadata.gz: cb1583fe183387972e1537bc2b90ebe9b224381e46515ffd202f3ad86cb4a545f906264644fff537b5937f8e4f985f39eb3123c6d47e2e8e5c1be31b425aad54
7
- data.tar.gz: 3a8b3a6e63a4ca03250d8e6697eda885abd6940f8b580f073ffa0c237a59a535d4997aa4591651c01cda61fd3f021508ed69d298a19512f783a9604b6dbcdd7c
6
+ metadata.gz: e811d984f82150ad789d1e3437fc178095dcaffa8270b15b96dd375d7dbf649e0983f8001a4fe09c4ea4abe89ba8c8cad9e44ae25c21bbecb65adf5542efd8fc
7
+ data.tar.gz: 1d64e212a2bb7331cba06020e9a9405b54ab558e691f4ef349ffc156a702f352209108fc62265b2ff8369a15656bdc4b158db13201b630d0ae3e2853e3b7c553
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.3
@@ -50,7 +50,7 @@ module RESTFramework::BaseModelControllerMixin
50
50
  protected
51
51
 
52
52
  # Get a native serializer config for the current action.
53
- # @return [RESTFramework::NativeModelSerializer]
53
+ # @return [RESTFramework::NativeSerializer]
54
54
  def get_native_serializer_config
55
55
  action_serializer_config = self.class.native_serializer_action_config || {}
56
56
  action = self.action_name.to_sym
@@ -64,10 +64,10 @@ module RESTFramework::BaseModelControllerMixin
64
64
  return (action_serializer_config[action] if action) || self.class.native_serializer_config
65
65
  end
66
66
 
67
- # Helper to get the configured serializer class, or `NativeModelSerializer` as a default.
67
+ # Helper to get the configured serializer class, or `NativeSerializer` as a default.
68
68
  # @return [RESTFramework::BaseSerializer]
69
69
  def get_serializer_class
70
- return self.class.serializer_class || RESTFramework::NativeModelSerializer
70
+ return self.class.serializer_class || RESTFramework::NativeSerializer
71
71
  end
72
72
 
73
73
  # Get a list of parameters allowed for the current action.
@@ -113,7 +113,7 @@ module RESTFramework::BaseModelControllerMixin
113
113
  # Get a record by the primary key from the filtered recordset.
114
114
  def get_record
115
115
  records = self.get_filtered_data(self.get_recordset)
116
- if pk = params[self.model.primary_key]
116
+ if pk = params[self.get_model.primary_key]
117
117
  return records.find(pk)
118
118
  end
119
119
  return nil
@@ -122,7 +122,7 @@ module RESTFramework::BaseModelControllerMixin
122
122
  # Internal interface for get_model, protecting against infinite recursion with get_recordset.
123
123
  def _get_model(from_internal_get_recordset: false)
124
124
  return @model if instance_variable_defined?(:@model) && @model
125
- return self.class.model if self.class.model
125
+ return (@model = self.class.model) if self.class.model
126
126
  unless from_internal_get_recordset # prevent infinite recursion
127
127
  recordset = self._get_recordset(from_internal_get_model: true)
128
128
  return (@model = recordset.klass) if recordset
@@ -137,7 +137,7 @@ module RESTFramework::BaseModelControllerMixin
137
137
  # Internal interface for get_recordset, protecting against infinite recursion with get_model.
138
138
  def _get_recordset(from_internal_get_model: false)
139
139
  return @recordset if instance_variable_defined?(:@recordset) && @recordset
140
- return self.class.recordset if self.class.recordset
140
+ return (@recordset = self.class.recordset) if self.class.recordset
141
141
  unless from_internal_get_model # prevent infinite recursion
142
142
  model = self._get_model(from_internal_get_recordset: true)
143
143
  return (@recordset = model.all) if model
@@ -11,7 +11,7 @@ end
11
11
  # This serializer uses `.as_json` to serialize objects. Despite the name, `.as_json` is an
12
12
  # `ActiveModel` method which converts objects to Ruby primitives (with the top-level being either
13
13
  # an array or a hash).
14
- class RESTFramework::NativeModelSerializer < RESTFramework::BaseSerializer
14
+ class RESTFramework::NativeSerializer < RESTFramework::BaseSerializer
15
15
  class_attribute :config
16
16
  class_attribute :singular_config
17
17
  class_attribute :plural_config
@@ -112,3 +112,7 @@ class RESTFramework::NativeModelSerializer < RESTFramework::BaseSerializer
112
112
  return @_nested_config[key] = value
113
113
  end
114
114
  end
115
+
116
+ # Alias NativeModelSerializer -> NativeSerializer.
117
+ class RESTFramework::NativeModelSerializer < RESTFramework::NativeSerializer
118
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rest_framework
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gregory N. Schmit
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-28 00:00:00.000000000 Z
11
+ date: 2021-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails