proxima 2.3.0 → 3.0.0
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/lib/proxima/model.rb +8 -7
- data/lib/proxima/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6b713a2b17dd31d9b1a111ec08290202966d986
|
4
|
+
data.tar.gz: 92179f0481fd7e1dce9655971f429cc34663c50d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f31b67e04ee633bb150f2a9bb56ab9b43bb8a2502b9b66518a9c2c6e20ffb428ac55c301c9f95009ba1405bf8094e27e9dad481130df5c0b83ce59203b1a044d
|
7
|
+
data.tar.gz: d3b4ff5daf627e957bfda2eb1798ed5542aeed210349f037812e82cfe1203a734b4ae9b4c484aebf8de8b52e74b3780608849e773af2bed21c1548505d052ce5
|
data/lib/proxima/model.rb
CHANGED
@@ -34,20 +34,20 @@ module Proxima
|
|
34
34
|
@responses || []
|
35
35
|
end
|
36
36
|
|
37
|
-
def self.create(record)
|
37
|
+
def self.create(record, params = {}, opts = {})
|
38
38
|
if record.is_a? Array
|
39
39
|
models = []
|
40
40
|
@responses = []
|
41
41
|
record.each do |record|
|
42
42
|
model = self.create record
|
43
|
-
@responses.push
|
43
|
+
@responses.push model.response
|
44
44
|
models.push(model) if model
|
45
45
|
end
|
46
46
|
return models
|
47
47
|
end
|
48
48
|
|
49
|
-
model = self.new
|
50
|
-
save_ok = model.save
|
49
|
+
model = self.new record
|
50
|
+
save_ok = model.save params, opts
|
51
51
|
@response = model.response
|
52
52
|
|
53
53
|
return nil unless save_ok
|
@@ -86,6 +86,7 @@ module Proxima
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def self.find_by_id(id, params = {}, opts = {})
|
89
|
+
raise "id cannot be blank" if id.blank?
|
89
90
|
params[:id] = id
|
90
91
|
@response = self.api.get self.find_by_id_path.call(params), opts
|
91
92
|
|
@@ -122,11 +123,11 @@ module Proxima
|
|
122
123
|
@response
|
123
124
|
end
|
124
125
|
|
125
|
-
def save(
|
126
|
+
def save(params = {}, opts = {})
|
126
127
|
return false unless self.valid?
|
127
128
|
|
128
129
|
if self.new_record?
|
129
|
-
path = self.class.create_path.call self.to_h
|
130
|
+
path = self.class.create_path.call self.to_h.merge(params)
|
130
131
|
payload = { json: self.as_json(opts) }
|
131
132
|
@response = self.class.api.post path, payload
|
132
133
|
|
@@ -140,7 +141,7 @@ module Proxima
|
|
140
141
|
return true if self.persisted?
|
141
142
|
|
142
143
|
opts[:flatten] = true if opts[:flatten] == nil
|
143
|
-
path = self.class.update_by_id_path.call
|
144
|
+
path = self.class.update_by_id_path.call self.to_h.merge(params)
|
144
145
|
payload = { json: self.as_json(opts) }
|
145
146
|
@response = self.class.api.put path, payload
|
146
147
|
|
data/lib/proxima/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proxima
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Hurst
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|