SFDO-API 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -7
- data/lib/SFDO/API.rb +18 -7
- data/lib/SFDO/API/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: babfcf40f932d8dd641788b972341bdf8b0ef602
|
4
|
+
data.tar.gz: 169d8dcc00a47bcb0249df2370cd294a13675a2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 165c8a21f5e2b246e3c0b960f96d0d20cee1f454f888403451d2ec1267358e116a50f8ab01d2b9bedd145c0e3dcc9778ccdad915e7fd30b8e1ce9b91da6ff44e
|
7
|
+
data.tar.gz: 60ab690da0d5a07dddc8a6371d579dc2241ff65a4d27ec3397a49a3934b3d237a1a21cd4d49805e704f5cd70ae74e54541345c6bcb29d03d4bd83c61d42685b2
|
data/README.md
CHANGED
@@ -50,12 +50,16 @@ When issuing a SELECT query, use the select_api() method with your query:
|
|
50
50
|
end
|
51
51
|
```
|
52
52
|
|
53
|
-
When doing
|
53
|
+
When doing operations for a custom object, leave off any namespace value at the front of the object name, and leave off any custom
|
54
|
+
trailer values like "__c" or "__r": SFDO-API retrieves the appropriate namespace and trailer values at run time. Instead of
|
55
|
+
addressing "npsp__General_Accounting_Unit__c" use plain "General_Accounting_Unit" instead
|
56
|
+
|
54
57
|
```ruby
|
55
|
-
gaus = select_api 'select Id from
|
58
|
+
gaus = select_api 'select Id from General_Accounting_Unit'
|
56
59
|
```
|
57
60
|
|
58
61
|
To delete a single instance of an object for which you have the Id value
|
62
|
+
|
59
63
|
```ruby
|
60
64
|
def delete_account_via_api
|
61
65
|
delete_one_account(@account_id)
|
@@ -85,22 +89,24 @@ To delete all instances of an object
|
|
85
89
|
|
86
90
|
### Custom Objects
|
87
91
|
|
88
|
-
To create instances of custom objects do not use any namespace value,
|
92
|
+
To create instances of custom objects do not use any namespace value at the front of the object name, and leave off any custom
|
93
|
+
trailer values like "__c" or "__r, SFDO-API handles that for you. Instead of addressing "npsp__General_Accounting_Unit__c"
|
94
|
+
use plain "General_Accounting_Unit" instead:
|
89
95
|
|
90
96
|
```ruby
|
91
97
|
def create_gau_via_api(gau_name)
|
92
|
-
@gau_id = create '
|
98
|
+
@gau_id = create 'General_Accounting_Unit', Name: gau_name
|
93
99
|
end
|
94
100
|
```
|
95
101
|
|
96
|
-
When using delete_one_foo or delete_all_foo do not use any namespace value, SFDO-API does that for you
|
102
|
+
When using delete_one_foo or delete_all_foo do not use any custom namespace value, SFDO-API does that for you
|
97
103
|
|
98
104
|
```ruby
|
99
105
|
def delete_gaus_via_api
|
100
106
|
api_client do
|
101
|
-
gaus = select_api 'select Id from
|
107
|
+
gaus = select_api 'select Id from General_Accounting_Unit'
|
102
108
|
puts gaus.inspect
|
103
|
-
|
109
|
+
delete_all_General_Accounting_Unit(gaus)
|
104
110
|
end
|
105
111
|
end
|
106
112
|
```
|
data/lib/SFDO/API.rb
CHANGED
@@ -73,23 +73,34 @@ module SfdoAPI
|
|
73
73
|
end
|
74
74
|
|
75
75
|
def true_object_name(handle) #either an ID or a string name
|
76
|
+
handle = (handle.end_with?("__c") || handle.end_with?("__r")) ? handle[0...-3] : handle
|
76
77
|
from_id = prefix_to_name[handle[0..2]]
|
77
|
-
from_name =
|
78
|
+
from_name = obj_names_without_custom_additions[handle]
|
78
79
|
if !from_name.nil? || !from_id.nil?
|
79
80
|
return from_name if from_id.nil?
|
80
81
|
return from_id if from_name.nil?
|
81
82
|
end
|
82
|
-
return '
|
83
|
+
return 'Unable to find object. Be sure to call SFDO-API without preceding namespace or following __c or __r'
|
83
84
|
end
|
84
85
|
|
85
|
-
def
|
86
|
-
if @
|
87
|
-
@
|
86
|
+
def obj_names_without_custom_additions
|
87
|
+
if @obj_names_without_custom_additions.nil? || !@obj_names_without_custom_additions.respond_to?(:contains)
|
88
|
+
@obj_names_without_custom_additions = {}
|
88
89
|
org_describe.each do |z|
|
89
|
-
|
90
|
+
tmp_var = z.name.split "__"
|
91
|
+
save = ""
|
92
|
+
case tmp_var.size
|
93
|
+
when 2
|
94
|
+
save = tmp_var.first
|
95
|
+
when 3
|
96
|
+
save = tmp_var[1]
|
97
|
+
else
|
98
|
+
save = tmp_var.last
|
99
|
+
end
|
100
|
+
@obj_names_without_custom_additions.store(save, z.name)
|
90
101
|
end
|
91
102
|
end
|
92
|
-
@
|
103
|
+
@obj_names_without_custom_additions
|
93
104
|
end
|
94
105
|
|
95
106
|
def get_object_describe(object_name)
|
data/lib/SFDO/API/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: SFDO-API
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris McMahon
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2016-10-
|
12
|
+
date: 2016-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|