active_force 0.7.0 → 0.15.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 +5 -5
- data/.circleci/config.yml +107 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +24 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.mailmap +3 -0
- data/CHANGELOG.md +122 -41
- data/CODEOWNERS +2 -0
- data/Gemfile +0 -1
- data/README.md +116 -16
- data/active_force.gemspec +11 -4
- data/lib/active_force/active_query.rb +107 -6
- data/lib/active_force/association/association.rb +48 -4
- data/lib/active_force/association/belongs_to_association.rb +25 -11
- data/lib/active_force/association/eager_load_projection_builder.rb +9 -3
- data/lib/active_force/association/has_many_association.rb +19 -19
- data/lib/active_force/association/has_one_association.rb +30 -0
- data/lib/active_force/association/relation_model_builder.rb +1 -1
- data/lib/active_force/association.rb +6 -4
- data/lib/active_force/{attribute.rb → field.rb} +3 -3
- data/lib/active_force/mapping.rb +6 -32
- data/lib/active_force/query.rb +21 -2
- data/lib/active_force/sobject.rb +75 -29
- data/lib/active_force/version.rb +3 -1
- data/lib/active_force.rb +9 -0
- data/lib/active_model/type/salesforce/multipicklist.rb +29 -0
- data/lib/active_model/type/salesforce/percent.rb +22 -0
- data/lib/generators/active_force/model/model_generator.rb +32 -21
- data/lib/generators/active_force/model/templates/model.rb.erb +3 -1
- data/spec/active_force/active_query_spec.rb +200 -8
- data/spec/active_force/association/relation_model_builder_spec.rb +22 -0
- data/spec/active_force/association_spec.rb +253 -10
- data/spec/active_force/callbacks_spec.rb +1 -1
- data/spec/active_force/field_spec.rb +34 -0
- data/spec/active_force/query_spec.rb +26 -0
- data/spec/active_force/sobject/includes_spec.rb +11 -11
- data/spec/active_force/sobject_spec.rb +223 -16
- data/spec/fixtures/sobject/single_sobject_hash.yml +1 -1
- data/spec/spec_helper.rb +5 -2
- data/spec/support/bangwhiz.rb +7 -0
- data/spec/support/restforce_factories.rb +1 -1
- data/spec/support/sobjects.rb +17 -1
- data/spec/support/whizbang.rb +2 -2
- metadata +64 -25
- data/lib/active_attr/dirty.rb +0 -24
- data/spec/active_force/attribute_spec.rb +0 -27
@@ -5,7 +5,7 @@ describe ActiveForce::SObject do
|
|
5
5
|
let(:client) { double 'Client' }
|
6
6
|
|
7
7
|
before do
|
8
|
-
|
8
|
+
ActiveForce.sfdc_client = client
|
9
9
|
end
|
10
10
|
|
11
11
|
describe ".new" do
|
@@ -25,10 +25,10 @@ describe ActiveForce::SObject do
|
|
25
25
|
expect(sobject.boolean).to be_an_instance_of TrueClass
|
26
26
|
expect(sobject.checkbox).to be_an_instance_of FalseClass
|
27
27
|
expect(sobject.date).to be_an_instance_of Date
|
28
|
-
expect(sobject.datetime).to be_an_instance_of
|
28
|
+
expect(sobject.datetime).to be_an_instance_of Time
|
29
29
|
expect(sobject.percent).to be_an_instance_of Float
|
30
30
|
expect(sobject.text).to be_an_instance_of String
|
31
|
-
expect(sobject.picklist_multiselect).to be_an_instance_of
|
31
|
+
expect(sobject.picklist_multiselect).to be_an_instance_of Array
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
@@ -65,15 +65,60 @@ describe ActiveForce::SObject do
|
|
65
65
|
end
|
66
66
|
end
|
67
67
|
|
68
|
-
|
68
|
+
describe 'having a default value' do
|
69
|
+
subject { Bangwhiz }
|
70
|
+
|
71
|
+
context 'when using the default value' do
|
72
|
+
let(:instantiation_attributes) { {name: 'some name'} }
|
73
|
+
let(:percent) { 50.0 }
|
74
|
+
|
75
|
+
it 'sends percent to salesforce' do
|
76
|
+
expect(client).to receive(:create!)
|
77
|
+
.with(anything, hash_including('Percent_Label' => percent))
|
78
|
+
subject.create(**instantiation_attributes)
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'sets percent field upon object instantiation' do
|
82
|
+
expect(subject.new(**instantiation_attributes)[:percent]).to eq(percent)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
context 'when overriding a default value' do
|
87
|
+
let(:instantiation_attributes) { {name: 'some name', percent: percent} }
|
88
|
+
let(:percent) { 25.0 }
|
89
|
+
|
90
|
+
it 'sends percent to salesforce' do
|
91
|
+
expect(client).to receive(:create!)
|
92
|
+
.with(anything, hash_including('Percent_Label' => percent))
|
93
|
+
subject.create(**instantiation_attributes)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'sets percent field upon object instantiation' do
|
97
|
+
expect(subject.new(**instantiation_attributes)[:percent]).to eq(percent)
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
context 'as: :multipicklist' do
|
69
103
|
before do
|
70
104
|
class IceCream < ActiveForce::SObject
|
71
|
-
field :flavors, as: :
|
105
|
+
field :flavors, as: :multipicklist
|
72
106
|
end
|
73
|
-
sundae.
|
107
|
+
sundae.clear_changes_information
|
74
108
|
sundae.flavors = %w(chocolate vanilla strawberry)
|
75
109
|
end
|
76
110
|
|
111
|
+
context 'mutation of multipicklist' do
|
112
|
+
let(:sundae) { IceCream.new }
|
113
|
+
|
114
|
+
before { sundae.clear_changes_information }
|
115
|
+
|
116
|
+
it 'detects mutation' do
|
117
|
+
sundae.flavors.delete('chocolate')
|
118
|
+
expect(sundae.flavors_changed?).to be true
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
77
122
|
context 'on create' do
|
78
123
|
let(:sundae) { IceCream.new }
|
79
124
|
it 'formats the picklist values' do
|
@@ -93,6 +138,25 @@ describe ActiveForce::SObject do
|
|
93
138
|
end
|
94
139
|
end
|
95
140
|
|
141
|
+
describe '.describe' do
|
142
|
+
subject { Whizbang.describe }
|
143
|
+
|
144
|
+
let(:describe_response) { { 'fields' => [] } }
|
145
|
+
|
146
|
+
before do
|
147
|
+
allow(client).to receive(:describe).and_return(describe_response)
|
148
|
+
end
|
149
|
+
|
150
|
+
it 'passes table_name to sfdc_client.describe' do
|
151
|
+
subject
|
152
|
+
expect(client).to have_received(:describe).with(Whizbang.table_name)
|
153
|
+
end
|
154
|
+
|
155
|
+
it 'returns response from describe' do
|
156
|
+
expect(subject).to eq(describe_response)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
96
160
|
describe "CRUD" do
|
97
161
|
let(:instance){ Whizbang.new(id: '1') }
|
98
162
|
|
@@ -140,12 +204,12 @@ describe ActiveForce::SObject do
|
|
140
204
|
end
|
141
205
|
|
142
206
|
describe 'and with a ClientError' do
|
143
|
-
let(:faraday_error){ Faraday::
|
207
|
+
let(:faraday_error){ Faraday::ClientError.new('Some String') }
|
144
208
|
|
145
209
|
before{ expect(client).to receive(:update!).and_raise(faraday_error) }
|
146
210
|
|
147
211
|
it 'raises an error' do
|
148
|
-
expect{ instance.update!( text: 'some text', boolean: false ) }.to raise_error(Faraday::
|
212
|
+
expect{ instance.update!( text: 'some text', boolean: false ) }.to raise_error(Faraday::ClientError)
|
149
213
|
end
|
150
214
|
end
|
151
215
|
end
|
@@ -198,12 +262,12 @@ describe ActiveForce::SObject do
|
|
198
262
|
end
|
199
263
|
|
200
264
|
describe 'and with a ClientError' do
|
201
|
-
let(:faraday_error){ Faraday::
|
265
|
+
let(:faraday_error){ Faraday::ClientError.new('Some String') }
|
202
266
|
|
203
267
|
before{ expect(client).to receive(:create!).and_raise(faraday_error) }
|
204
268
|
|
205
269
|
it 'raises an error' do
|
206
|
-
expect{ instance.create! }.to raise_error(Faraday::
|
270
|
+
expect{ instance.create! }.to raise_error(Faraday::ClientError)
|
207
271
|
end
|
208
272
|
end
|
209
273
|
end
|
@@ -226,7 +290,9 @@ describe ActiveForce::SObject do
|
|
226
290
|
|
227
291
|
describe 'self.create' do
|
228
292
|
before do
|
229
|
-
expect(client).to receive(:create!)
|
293
|
+
expect(client).to receive(:create!)
|
294
|
+
.with(Whizbang.table_name, { 'Text_Label' => 'some text', 'Updated_From__c' => 'Rails' })
|
295
|
+
.and_return('id')
|
230
296
|
end
|
231
297
|
|
232
298
|
it 'should create a new instance' do
|
@@ -256,6 +322,103 @@ describe ActiveForce::SObject do
|
|
256
322
|
end
|
257
323
|
end
|
258
324
|
|
325
|
+
describe "#find_by!" do
|
326
|
+
it "queries the client, with the SFDC field names and correctly enclosed values" do
|
327
|
+
expect(client).to receive(:query).with("SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c WHERE (Id = 123) AND (Text_Label = 'foo') LIMIT 1").and_return([Restforce::Mash.new(Id: 123, text: 'foo')])
|
328
|
+
Whizbang.find_by! id: 123, text: "foo"
|
329
|
+
end
|
330
|
+
it "raises if nothing found" do
|
331
|
+
expect(client).to receive(:query).with("SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c WHERE (Id = 123) AND (Text_Label = 'foo') LIMIT 1")
|
332
|
+
expect { Whizbang.find_by! id: 123, text: "foo" }.to raise_error(ActiveForce::RecordNotFound)
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
describe '.find!' do
|
337
|
+
let(:id) { 'abc123' }
|
338
|
+
|
339
|
+
before do
|
340
|
+
allow(client).to receive(:query)
|
341
|
+
end
|
342
|
+
|
343
|
+
it 'returns found record' do
|
344
|
+
query = "SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c WHERE (Id = '#{id}') LIMIT 1"
|
345
|
+
expected = Restforce::Mash.new(Id: id)
|
346
|
+
allow(client).to receive(:query).with(query).and_return([expected])
|
347
|
+
actual = Whizbang.find!(id)
|
348
|
+
expect(actual.id).to eq(expected.Id)
|
349
|
+
end
|
350
|
+
|
351
|
+
it 'raises RecordNotFound if nothing found' do
|
352
|
+
expect { Whizbang.find!(id) }
|
353
|
+
.to raise_error(ActiveForce::RecordNotFound, "Couldn't find #{Whizbang.table_name} with id #{id}")
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
describe '#pluck' do
|
358
|
+
let(:record_attributes) { [] }
|
359
|
+
|
360
|
+
before do
|
361
|
+
collection = build_restforce_collection(record_attributes.map { |a| build_restforce_sobject(a) })
|
362
|
+
allow(client).to receive(:query).and_return(collection)
|
363
|
+
end
|
364
|
+
|
365
|
+
it 'returns empty array if no records returned from query' do
|
366
|
+
expect(Whizbang.pluck).to eq([])
|
367
|
+
end
|
368
|
+
|
369
|
+
it 'works with another query' do
|
370
|
+
expected = 'SELECT Id, Text_Label FROM Whizbang__c WHERE (Checkbox_Label = true)'
|
371
|
+
Whizbang.where(checkbox: true).pluck(:id, :text)
|
372
|
+
expect(client).to have_received(:query).with(expected)
|
373
|
+
end
|
374
|
+
|
375
|
+
context 'when given no fields' do
|
376
|
+
it 'queries for all fields' do
|
377
|
+
expected = "SELECT #{Whizbang.fields.join ', '} FROM Whizbang__c"
|
378
|
+
Whizbang.pluck
|
379
|
+
expect(client).to have_received(:query).with(expected)
|
380
|
+
end
|
381
|
+
end
|
382
|
+
|
383
|
+
context 'when given one field' do
|
384
|
+
let(:ids) { ['a', 'b', 1] }
|
385
|
+
let(:record_attributes) { ids.map { |v| { 'Id' => v } } }
|
386
|
+
|
387
|
+
it 'queries for only that field' do
|
388
|
+
expected = 'SELECT Id FROM Whizbang__c'
|
389
|
+
Whizbang.pluck(:id)
|
390
|
+
expect(client).to have_received(:query).with(expected)
|
391
|
+
end
|
392
|
+
|
393
|
+
it 'returns an array of casted values for that field' do
|
394
|
+
expect(Whizbang.pluck(:id)).to match_array(ids.map(&:to_s))
|
395
|
+
end
|
396
|
+
end
|
397
|
+
|
398
|
+
context 'when given more than one field' do
|
399
|
+
let(:record_attributes) do
|
400
|
+
[
|
401
|
+
{ 'Text_Label' => 'test1', 'Date_Label' => '2023-01-01' },
|
402
|
+
{ 'Text_Label' => 'test2', 'Date_Label' => '2023-01-02' }
|
403
|
+
]
|
404
|
+
end
|
405
|
+
|
406
|
+
it 'queries for only those fields' do
|
407
|
+
expected = 'SELECT Text_Label, Date_Label FROM Whizbang__c'
|
408
|
+
Whizbang.pluck(:text, :date)
|
409
|
+
expect(client).to have_received(:query).with(expected)
|
410
|
+
end
|
411
|
+
|
412
|
+
it 'returns an array of arrays of casted values in the correct order' do
|
413
|
+
expected = [
|
414
|
+
['test1', Date.new(2023, 1, 1)],
|
415
|
+
['test2', Date.new(2023, 1, 2)]
|
416
|
+
]
|
417
|
+
expect(Whizbang.pluck(:text, :date)).to match_array(expected)
|
418
|
+
end
|
419
|
+
end
|
420
|
+
end
|
421
|
+
|
259
422
|
describe '#reload' do
|
260
423
|
let(:client) do
|
261
424
|
double("sfdc_client", query: [Restforce::Mash.new(Id: 1, Name: 'Jeff')])
|
@@ -264,7 +427,7 @@ describe ActiveForce::SObject do
|
|
264
427
|
let(:territory){ Territory.new(id: '1', quota_id: '1') }
|
265
428
|
|
266
429
|
before do
|
267
|
-
|
430
|
+
ActiveForce.sfdc_client = client
|
268
431
|
end
|
269
432
|
|
270
433
|
it 'clears cached associations' do
|
@@ -314,7 +477,7 @@ describe ActiveForce::SObject do
|
|
314
477
|
let(:instance){ Whizbang.new }
|
315
478
|
|
316
479
|
before do
|
317
|
-
allow(instance).to receive(:create!).and_raise(Faraday::
|
480
|
+
allow(instance).to receive(:create!).and_raise(Faraday::ClientError.new(double))
|
318
481
|
end
|
319
482
|
|
320
483
|
it 'catches and logs the error' do
|
@@ -323,6 +486,22 @@ describe ActiveForce::SObject do
|
|
323
486
|
end
|
324
487
|
end
|
325
488
|
|
489
|
+
describe 'to_json' do
|
490
|
+
let(:instance) { Whizbang.new }
|
491
|
+
|
492
|
+
it 'responds to' do
|
493
|
+
expect(instance).to respond_to(:to_json)
|
494
|
+
end
|
495
|
+
end
|
496
|
+
|
497
|
+
describe 'as_json' do
|
498
|
+
let(:instance) { Whizbang.new }
|
499
|
+
|
500
|
+
it 'responds to' do
|
501
|
+
expect(instance).to respond_to(:as_json)
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
326
505
|
describe ".save!" do
|
327
506
|
let(:instance){ Whizbang.new }
|
328
507
|
|
@@ -335,12 +514,12 @@ describe ActiveForce::SObject do
|
|
335
514
|
end
|
336
515
|
|
337
516
|
describe 'and with a ClientError' do
|
338
|
-
let(:faraday_error){ Faraday::
|
517
|
+
let(:faraday_error){ Faraday::ClientError.new('Some String') }
|
339
518
|
|
340
519
|
before{ expect(client).to receive(:create!).and_raise(faraday_error) }
|
341
520
|
|
342
521
|
it 'raises an error' do
|
343
|
-
expect{ instance.save! }.to raise_error(Faraday::
|
522
|
+
expect{ instance.save! }.to raise_error(Faraday::ClientError)
|
344
523
|
end
|
345
524
|
end
|
346
525
|
end
|
@@ -354,6 +533,34 @@ describe ActiveForce::SObject do
|
|
354
533
|
end
|
355
534
|
end
|
356
535
|
|
536
|
+
describe '#[]' do
|
537
|
+
let(:sobject){ Whizbang.build sobject_hash }
|
538
|
+
|
539
|
+
it 'allows accessing the attribute values as if the Sobject were a Hash' do
|
540
|
+
expect(sobject[:boolean]).to eq sobject.boolean
|
541
|
+
expect(sobject[:checkbox]).to eq sobject.checkbox
|
542
|
+
expect(sobject[:date]).to eq sobject.date
|
543
|
+
expect(sobject[:datetime]).to eq sobject.datetime
|
544
|
+
expect(sobject[:percent]).to eq sobject.percent
|
545
|
+
expect(sobject[:text]).to eq sobject.text
|
546
|
+
expect(sobject[:picklist_multiselect]).to eq sobject.picklist_multiselect
|
547
|
+
end
|
548
|
+
end
|
549
|
+
|
550
|
+
describe '#[]=' do
|
551
|
+
let(:sobject){ Whizbang.new }
|
552
|
+
|
553
|
+
it 'allows modifying the attribute values as if the Sobject were a Hash' do
|
554
|
+
expect(sobject[:boolean]=false).to eq sobject.boolean
|
555
|
+
expect(sobject[:checkbox]=true).to eq sobject.checkbox
|
556
|
+
expect(sobject[:datetime]=Time.now).to eq sobject.datetime
|
557
|
+
expect(sobject[:percent]=50).to eq sobject.percent
|
558
|
+
expect(sobject[:text]='foo-bar').to eq sobject.text
|
559
|
+
sobject[:picklist_multiselect]='a;b'
|
560
|
+
expect(sobject.picklist_multiselect).to eq ['a', 'b']
|
561
|
+
end
|
562
|
+
end
|
563
|
+
|
357
564
|
describe ".save" do
|
358
565
|
let(:instance){ Whizbang.new }
|
359
566
|
|
@@ -366,7 +573,7 @@ describe ActiveForce::SObject do
|
|
366
573
|
end
|
367
574
|
|
368
575
|
describe 'and with a ClientError' do
|
369
|
-
let(:faraday_error){ Faraday::
|
576
|
+
let(:faraday_error){ Faraday::ClientError.new('Some String') }
|
370
577
|
before{ expect(client).to receive(:create!).and_raise(faraday_error) }
|
371
578
|
it 'returns false' do
|
372
579
|
expect(instance.save).to eq(false)
|
data/spec/spec_helper.rb
CHANGED
data/spec/support/sobjects.rb
CHANGED
@@ -15,6 +15,8 @@ class Post < ActiveForce::SObject
|
|
15
15
|
has_many :reply_comments, model: Comment, scoped_as: ->(post){ where(body: "RE: #{post.title}").order('CreationDate DESC') }
|
16
16
|
has_many :ugly_comments, { model: Comment }
|
17
17
|
has_many :poster_comments, { foreign_key: :poster_id, model: Comment }
|
18
|
+
has_one :last_comment, model: Comment, scoped_as: -> { where.not(body: nil).order('CreatedDate DESC') }
|
19
|
+
has_one :repeat_comment, model: Comment, scoped_as: ->(post) { where(body: post.title) }
|
18
20
|
end
|
19
21
|
class Territory < ActiveForce::SObject
|
20
22
|
field :quota_id, from: "Quota__c"
|
@@ -47,6 +49,17 @@ class EnforcedTableName < ActiveForce::SObject
|
|
47
49
|
self.table_name = 'Forced__c'
|
48
50
|
end
|
49
51
|
|
52
|
+
class HasOneChild < ActiveForce::SObject
|
53
|
+
field :has_one_parent_id, from: 'has_one_parent_id__c'
|
54
|
+
field :fancy_parent_id, from: 'FancyParentId'
|
55
|
+
belongs_to :has_one_parent, foreign_key: :has_one_parent_id
|
56
|
+
end
|
57
|
+
|
58
|
+
class HasOneParent < ActiveForce::SObject
|
59
|
+
field :comment
|
60
|
+
has_one :has_one_child, model: HasOneChild
|
61
|
+
end
|
62
|
+
|
50
63
|
module Foo
|
51
64
|
class Bar < ActiveForce::SObject; end
|
52
65
|
class Opportunity < ActiveForce::SObject
|
@@ -57,7 +70,10 @@ module Foo
|
|
57
70
|
has_many :opportunities, model: Foo::Opportunity
|
58
71
|
has_many :partner_opportunities, foreign_key: :partner_account_id, model: Foo::Opportunity
|
59
72
|
end
|
60
|
-
class Lead < ActiveForce::SObject
|
73
|
+
class Lead < ActiveForce::SObject
|
74
|
+
has_one :attachment, model: 'Foo::Attachment'
|
75
|
+
has_one :fancy_attachment, model: 'Foo::Attachment', foreign_key: :fancy_lead_id
|
76
|
+
end
|
61
77
|
class Attachment < ActiveForce::SObject
|
62
78
|
field :lead_id, from: 'Lead_Id__c'
|
63
79
|
field :fancy_lead_id, from: 'LeadId'
|
data/spec/support/whizbang.rb
CHANGED
@@ -9,7 +9,7 @@ class Whizbang < ActiveForce::SObject
|
|
9
9
|
field :boolean, from: 'Boolean_Label', as: :boolean
|
10
10
|
field :percent, from: 'Percent_Label', as: :percent
|
11
11
|
field :estimated_close_date, as: :datetime
|
12
|
-
field :updated_from, as: :
|
12
|
+
field :updated_from, as: :string
|
13
13
|
field :dirty_attribute, as: :boolean
|
14
14
|
|
15
15
|
before_save :set_as_updated_from_rails
|
@@ -27,4 +27,4 @@ class Whizbang < ActiveForce::SObject
|
|
27
27
|
self.dirty_attribute = true
|
28
28
|
end
|
29
29
|
|
30
|
-
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,60 +1,60 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_force
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.15.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eloy Espinaco
|
8
8
|
- Pablo Oldani
|
9
9
|
- Armando Andini
|
10
10
|
- José Piccioni
|
11
|
-
autorequire:
|
11
|
+
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2023-05-26 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
17
|
+
name: activemodel
|
18
18
|
requirement: !ruby/object:Gem::Requirement
|
19
19
|
requirements:
|
20
20
|
- - "~>"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '0
|
22
|
+
version: '7.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0
|
29
|
+
version: '7.0'
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
|
-
name:
|
31
|
+
name: activesupport
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
33
33
|
requirements:
|
34
34
|
- - "~>"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: '
|
36
|
+
version: '7.0'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: '
|
43
|
+
version: '7.0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
|
-
name:
|
45
|
+
name: restforce
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
|
-
version: '
|
51
|
-
type: :
|
50
|
+
version: '5'
|
51
|
+
type: :runtime
|
52
52
|
prerelease: false
|
53
53
|
version_requirements: !ruby/object:Gem::Requirement
|
54
54
|
requirements:
|
55
|
-
- - "
|
55
|
+
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
version: '
|
57
|
+
version: '5'
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rake
|
60
60
|
requirement: !ruby/object:Gem::Requirement
|
@@ -83,6 +83,20 @@ dependencies:
|
|
83
83
|
- - ">="
|
84
84
|
- !ruby/object:Gem::Version
|
85
85
|
version: '0'
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: rspec_junit_formatter
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
86
100
|
- !ruby/object:Gem::Dependency
|
87
101
|
name: pry
|
88
102
|
requirement: !ruby/object:Gem::Requirement
|
@@ -97,22 +111,40 @@ dependencies:
|
|
97
111
|
- - ">="
|
98
112
|
- !ruby/object:Gem::Version
|
99
113
|
version: '0'
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: simplecov
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
100
128
|
description: Use SalesForce as an ActiveModel
|
101
129
|
email: eloyesp@gmail.com
|
102
130
|
executables: []
|
103
131
|
extensions: []
|
104
132
|
extra_rdoc_files: []
|
105
133
|
files:
|
134
|
+
- ".circleci/config.yml"
|
135
|
+
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
136
|
+
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
106
137
|
- ".gitignore"
|
138
|
+
- ".mailmap"
|
107
139
|
- ".rspec"
|
108
140
|
- ".travis.yml"
|
109
141
|
- CHANGELOG.md
|
142
|
+
- CODEOWNERS
|
110
143
|
- Gemfile
|
111
144
|
- LICENSE.txt
|
112
145
|
- README.md
|
113
146
|
- Rakefile
|
114
147
|
- active_force.gemspec
|
115
|
-
- lib/active_attr/dirty.rb
|
116
148
|
- lib/active_force.rb
|
117
149
|
- lib/active_force/active_query.rb
|
118
150
|
- lib/active_force/association.rb
|
@@ -120,22 +152,25 @@ files:
|
|
120
152
|
- lib/active_force/association/belongs_to_association.rb
|
121
153
|
- lib/active_force/association/eager_load_projection_builder.rb
|
122
154
|
- lib/active_force/association/has_many_association.rb
|
155
|
+
- lib/active_force/association/has_one_association.rb
|
123
156
|
- lib/active_force/association/relation_model_builder.rb
|
124
|
-
- lib/active_force/
|
157
|
+
- lib/active_force/field.rb
|
125
158
|
- lib/active_force/mapping.rb
|
126
159
|
- lib/active_force/query.rb
|
127
160
|
- lib/active_force/sobject.rb
|
128
161
|
- lib/active_force/standard_types.rb
|
129
162
|
- lib/active_force/table.rb
|
130
163
|
- lib/active_force/version.rb
|
164
|
+
- lib/active_model/type/salesforce/multipicklist.rb
|
165
|
+
- lib/active_model/type/salesforce/percent.rb
|
131
166
|
- lib/generators/active_force/model/USAGE
|
132
167
|
- lib/generators/active_force/model/model_generator.rb
|
133
168
|
- lib/generators/active_force/model/templates/model.rb.erb
|
134
169
|
- spec/active_force/active_query_spec.rb
|
135
170
|
- spec/active_force/association/relation_model_builder_spec.rb
|
136
171
|
- spec/active_force/association_spec.rb
|
137
|
-
- spec/active_force/attribute_spec.rb
|
138
172
|
- spec/active_force/callbacks_spec.rb
|
173
|
+
- spec/active_force/field_spec.rb
|
139
174
|
- spec/active_force/mapping_spec.rb
|
140
175
|
- spec/active_force/query_spec.rb
|
141
176
|
- spec/active_force/sobject/includes_spec.rb
|
@@ -145,15 +180,19 @@ files:
|
|
145
180
|
- spec/active_force_spec.rb
|
146
181
|
- spec/fixtures/sobject/single_sobject_hash.yml
|
147
182
|
- spec/spec_helper.rb
|
183
|
+
- spec/support/bangwhiz.rb
|
148
184
|
- spec/support/fixture_helpers.rb
|
149
185
|
- spec/support/restforce_factories.rb
|
150
186
|
- spec/support/sobjects.rb
|
151
187
|
- spec/support/whizbang.rb
|
152
|
-
homepage: https://github.com/
|
188
|
+
homepage: https://github.com/Beyond-Finance/active_force#readme
|
153
189
|
licenses:
|
154
190
|
- MIT
|
155
|
-
metadata:
|
156
|
-
|
191
|
+
metadata:
|
192
|
+
bug_tracker_uri: https://github.com/Beyond-Finance/active_force/issues
|
193
|
+
changelog_uri: https://github.com/Beyond-Finance/active_force/blob/main/CHANGELOG.md
|
194
|
+
source_code_uri: https://github.com/Beyond-Finance/active_force
|
195
|
+
post_install_message:
|
157
196
|
rdoc_options: []
|
158
197
|
require_paths:
|
159
198
|
- lib
|
@@ -168,17 +207,16 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
168
207
|
- !ruby/object:Gem::Version
|
169
208
|
version: '0'
|
170
209
|
requirements: []
|
171
|
-
|
172
|
-
|
173
|
-
signing_key:
|
210
|
+
rubygems_version: 3.4.6
|
211
|
+
signing_key:
|
174
212
|
specification_version: 4
|
175
213
|
summary: Help you implement models persisting on Sales Force within Rails using RESTForce
|
176
214
|
test_files:
|
177
215
|
- spec/active_force/active_query_spec.rb
|
178
216
|
- spec/active_force/association/relation_model_builder_spec.rb
|
179
217
|
- spec/active_force/association_spec.rb
|
180
|
-
- spec/active_force/attribute_spec.rb
|
181
218
|
- spec/active_force/callbacks_spec.rb
|
219
|
+
- spec/active_force/field_spec.rb
|
182
220
|
- spec/active_force/mapping_spec.rb
|
183
221
|
- spec/active_force/query_spec.rb
|
184
222
|
- spec/active_force/sobject/includes_spec.rb
|
@@ -188,6 +226,7 @@ test_files:
|
|
188
226
|
- spec/active_force_spec.rb
|
189
227
|
- spec/fixtures/sobject/single_sobject_hash.yml
|
190
228
|
- spec/spec_helper.rb
|
229
|
+
- spec/support/bangwhiz.rb
|
191
230
|
- spec/support/fixture_helpers.rb
|
192
231
|
- spec/support/restforce_factories.rb
|
193
232
|
- spec/support/sobjects.rb
|
data/lib/active_attr/dirty.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
require 'active_support'
|
2
|
-
require 'active_model/dirty'
|
3
|
-
require 'active_attr'
|
4
|
-
|
5
|
-
module ActiveAttr
|
6
|
-
module Dirty
|
7
|
-
extend ActiveSupport::Concern
|
8
|
-
include ActiveModel::Dirty
|
9
|
-
|
10
|
-
module ClassMethods
|
11
|
-
def attribute!(name, options={})
|
12
|
-
super(name, options)
|
13
|
-
define_method("#{name}=") do |value|
|
14
|
-
send("#{name}_will_change!") unless value == read_attribute(name)
|
15
|
-
super(value)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
def attributes_and_changes
|
21
|
-
attributes.select{ |attr, key| changed.include? attr }
|
22
|
-
end
|
23
|
-
end
|
24
|
-
end
|