active_force 0.6.1 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +7 -0
  3. data/README.md +43 -17
  4. data/lib/active_attr/dirty.rb +3 -0
  5. data/lib/active_force/active_query.rb +32 -2
  6. data/lib/active_force/association.rb +14 -10
  7. data/lib/active_force/association/association.rb +26 -11
  8. data/lib/active_force/association/belongs_to_association.rb +1 -4
  9. data/lib/active_force/association/eager_load_projection_builder.rb +60 -0
  10. data/lib/active_force/association/has_many_association.rb +15 -5
  11. data/lib/active_force/association/relation_model_builder.rb +70 -0
  12. data/lib/active_force/attribute.rb +30 -0
  13. data/lib/active_force/mapping.rb +78 -0
  14. data/lib/active_force/query.rb +2 -8
  15. data/lib/active_force/sobject.rb +79 -95
  16. data/lib/active_force/table.rb +6 -2
  17. data/lib/active_force/version.rb +1 -1
  18. data/lib/generators/active_force/model/model_generator.rb +1 -0
  19. data/lib/generators/active_force/model/templates/model.rb.erb +0 -2
  20. data/spec/active_force/active_query_spec.rb +39 -12
  21. data/spec/active_force/association/relation_model_builder_spec.rb +62 -0
  22. data/spec/active_force/association_spec.rb +53 -88
  23. data/spec/active_force/attribute_spec.rb +27 -0
  24. data/spec/active_force/callbacks_spec.rb +1 -23
  25. data/spec/active_force/mapping_spec.rb +18 -0
  26. data/spec/active_force/query_spec.rb +32 -54
  27. data/spec/active_force/sobject/includes_spec.rb +290 -0
  28. data/spec/active_force/sobject/table_name_spec.rb +0 -21
  29. data/spec/active_force/sobject_spec.rb +212 -29
  30. data/spec/active_force/table_spec.rb +0 -3
  31. data/spec/fixtures/sobject/single_sobject_hash.yml +2 -0
  32. data/spec/spec_helper.rb +10 -4
  33. data/spec/support/restforce_factories.rb +9 -0
  34. data/spec/support/sobjects.rb +97 -0
  35. data/spec/support/whizbang.rb +25 -7
  36. metadata +18 -2
@@ -1,12 +1,30 @@
1
1
  class Whizbang < ActiveForce::SObject
2
2
 
3
3
  field :id, from: 'Id'
4
- field :checkbox, from: 'Checkbox_Label'
4
+ field :checkbox, from: 'Checkbox_Label', as: :boolean
5
5
  field :text, from: 'Text_Label'
6
- field :date, from: 'Date_Label'
7
- field :datetime, from: 'DateTime_Label'
8
- field :picklist_multiselect, from: 'Picklist_Multiselect_Label'
9
- field :boolean, from: 'Boolean_Label'
10
- field :estimated_close_date
6
+ field :date, from: 'Date_Label', as: :date
7
+ field :datetime, from: 'DateTime_Label', as: :datetime
8
+ field :picklist_multiselect, from: 'Picklist_Multiselect_Label', as: :multipicklist
9
+ field :boolean, from: 'Boolean_Label', as: :boolean
10
+ field :percent, from: 'Percent_Label', as: :percent
11
+ field :estimated_close_date, as: :datetime
12
+ field :updated_from, as: :datetime
13
+ field :dirty_attribute, as: :boolean
11
14
 
12
- end
15
+ before_save :set_as_updated_from_rails
16
+ after_save :mark_dirty
17
+
18
+ validates :percent, presence: true, if: :boolean
19
+
20
+ private
21
+
22
+ def set_as_updated_from_rails
23
+ self.updated_from = 'Rails'
24
+ end
25
+
26
+ def mark_dirty
27
+ self.dirty_attribute = true
28
+ end
29
+
30
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: active_force
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eloy Espinaco
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-09-03 00:00:00.000000000 Z
14
+ date: 2014-10-10 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: active_attr
@@ -118,7 +118,11 @@ files:
118
118
  - lib/active_force/association.rb
119
119
  - lib/active_force/association/association.rb
120
120
  - lib/active_force/association/belongs_to_association.rb
121
+ - lib/active_force/association/eager_load_projection_builder.rb
121
122
  - lib/active_force/association/has_many_association.rb
123
+ - lib/active_force/association/relation_model_builder.rb
124
+ - lib/active_force/attribute.rb
125
+ - lib/active_force/mapping.rb
122
126
  - lib/active_force/query.rb
123
127
  - lib/active_force/sobject.rb
124
128
  - lib/active_force/standard_types.rb
@@ -128,9 +132,13 @@ files:
128
132
  - lib/generators/active_force/model/model_generator.rb
129
133
  - lib/generators/active_force/model/templates/model.rb.erb
130
134
  - spec/active_force/active_query_spec.rb
135
+ - spec/active_force/association/relation_model_builder_spec.rb
131
136
  - spec/active_force/association_spec.rb
137
+ - spec/active_force/attribute_spec.rb
132
138
  - spec/active_force/callbacks_spec.rb
139
+ - spec/active_force/mapping_spec.rb
133
140
  - spec/active_force/query_spec.rb
141
+ - spec/active_force/sobject/includes_spec.rb
134
142
  - spec/active_force/sobject/table_name_spec.rb
135
143
  - spec/active_force/sobject_spec.rb
136
144
  - spec/active_force/table_spec.rb
@@ -138,6 +146,8 @@ files:
138
146
  - spec/fixtures/sobject/single_sobject_hash.yml
139
147
  - spec/spec_helper.rb
140
148
  - spec/support/fixture_helpers.rb
149
+ - spec/support/restforce_factories.rb
150
+ - spec/support/sobjects.rb
141
151
  - spec/support/whizbang.rb
142
152
  homepage: https://github.com/ionia-corporation/active_force
143
153
  licenses:
@@ -165,9 +175,13 @@ specification_version: 4
165
175
  summary: Help you implement models persisting on Sales Force within Rails using RESTForce
166
176
  test_files:
167
177
  - spec/active_force/active_query_spec.rb
178
+ - spec/active_force/association/relation_model_builder_spec.rb
168
179
  - spec/active_force/association_spec.rb
180
+ - spec/active_force/attribute_spec.rb
169
181
  - spec/active_force/callbacks_spec.rb
182
+ - spec/active_force/mapping_spec.rb
170
183
  - spec/active_force/query_spec.rb
184
+ - spec/active_force/sobject/includes_spec.rb
171
185
  - spec/active_force/sobject/table_name_spec.rb
172
186
  - spec/active_force/sobject_spec.rb
173
187
  - spec/active_force/table_spec.rb
@@ -175,4 +189,6 @@ test_files:
175
189
  - spec/fixtures/sobject/single_sobject_hash.yml
176
190
  - spec/spec_helper.rb
177
191
  - spec/support/fixture_helpers.rb
192
+ - spec/support/restforce_factories.rb
193
+ - spec/support/sobjects.rb
178
194
  - spec/support/whizbang.rb