SFDO-API 0.1.6 → 0.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be6528c0a458a146c3ae52b5a59b9504d81cd219
4
- data.tar.gz: 28b4defea23aac1e34fb703d69b3872a9d0aff75
3
+ metadata.gz: babfcf40f932d8dd641788b972341bdf8b0ef602
4
+ data.tar.gz: 169d8dcc00a47bcb0249df2370cd294a13675a2e
5
5
  SHA512:
6
- metadata.gz: f3375dd2d43439605a4ec80155323a0d88651ccf7526808d18fb0babb1c086257e8e732b4f9b6e72d1fdb57f79a1fd80135c1fc85da2d923317fa8d0adafe09f
7
- data.tar.gz: f5ae2b0277f5fd587ee8a000c9fd326e76a08f9132cf8720c57fb3833dfe55fad9098642425767326c702a9a8d14522eec8355d611bf1df856831c6767775775
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 SELECT for a custom object, leave off any namespace value, SFDO-API retrieves the appropriate namespace at run time:
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 General_Accounting_Unit__c'
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, SFDO-API does that for you
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 'General_Accounting_Unit__c', Name: gau_name
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 General_Accounting_Unit__c'
107
+ gaus = select_api 'select Id from General_Accounting_Unit'
102
108
  puts gaus.inspect
103
- delete_all_General_Accounting_Unit__c(gaus)
109
+ delete_all_General_Accounting_Unit(gaus)
104
110
  end
105
111
  end
106
112
  ```
@@ -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 = obj_names_without_namespace[handle]
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 'invalid'
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 obj_names_without_namespace
86
- if @obj_names_without_namespace.nil? || !@obj_names_without_namespace.respond_to?(:contains)
87
- @obj_names_without_namespace = {}
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
- @obj_names_without_namespace.store(z.name.split("__",2).last, z.name)
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
- @obj_names_without_namespace
103
+ @obj_names_without_custom_additions
93
104
  end
94
105
 
95
106
  def get_object_describe(object_name)
@@ -1,5 +1,5 @@
1
1
  module SFDO
2
2
  module API
3
- VERSION = "0.1.6"
3
+ VERSION = "0.1.7"
4
4
  end
5
5
  end
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.6
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-14 00:00:00.000000000 Z
12
+ date: 2016-10-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler