SFDO-API 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ee72501902798d88fe262d4de5a4116e2ad25c0f
4
- data.tar.gz: 5561b32e32ed186f309f254356ed0d7664fa185b
3
+ metadata.gz: 3c5ac4fce7bcb1811b8411e06b3c4093cd3c1e30
4
+ data.tar.gz: ae55da93d0e74c8e93b1485da7f71c7b3350c69f
5
5
  SHA512:
6
- metadata.gz: 49aa21b2262711aa7496cd78f1ec5f2eabee87c29ae5f11877876ed9bf104799877ffb91297dd46c502520eea9d6c2e9116d87dab7f38df732ef5b03445887b8
7
- data.tar.gz: 5129c3ccfbe7ad2b077df709647797295159d0fb97fe2dc76994fb51675ab25bbcd8114e0f244f701537e2846253d0990118017b79e353eab277585307a63a9d
6
+ metadata.gz: beaa7d440863531e632663e60ae8d874fed6eb99f859dc85866d1509dce58efeebbf11385c3569ade3eaf8d28790a95aa2b1beada840611c86cfe1c0d805f5bd
7
+ data.tar.gz: feb8a9545e9a9ad8f47de19e949e5ec2f96135dafce7c38388556b948bb91878c6c9e1ff32f052c5f4fde748d90aebcd9053d431fcd599268c679c54afb2fd2f
@@ -21,5 +21,6 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_development_dependency "bundler", "~> 1.10"
23
23
  spec.add_development_dependency "rake", "~> 10.0"
24
+ spec.add_dependency "pry"
24
25
  spec.add_dependency "restforce", "~> 2.1.1"
25
26
  end
@@ -1,4 +1,5 @@
1
1
  require 'SFDO/API/version'
2
+ require 'pry'
2
3
 
3
4
  module SfdoAPI
4
5
 
@@ -35,6 +36,13 @@ module SfdoAPI
35
36
  valid
36
37
  end
37
38
 
39
+ def get_org_objects()
40
+ #binding.pry
41
+ @org_objects ||= api_client do
42
+ @api_client.describe
43
+ end
44
+ end
45
+
38
46
  def get_object_describe(object_name)
39
47
  api_client do
40
48
  @description = @api_client.get("/services/data/v35.0/sobjects/#{object_name}/describe")
@@ -50,6 +58,40 @@ module SfdoAPI
50
58
  required.select(&:required)
51
59
  end
52
60
  end
61
+
62
+ def delete(type, obj_id)
63
+ api_client do
64
+ @api_client.destroy(type, obj_id)
65
+ end
66
+ end
67
+
68
+ def delete_all(obj_type, id)
69
+ api_client do
70
+ #p "id is " + id.inspect
71
+ #@api_client.destroy(obj_type, id)
72
+ id.each(&:destroy)
73
+ end
74
+ end
75
+
76
+ # Given that the developer calls 'delete_contact(id)'
77
+ # When 'contact' is a valid object
78
+ # Then this method_missing method, will translate 'delete_contact' into "generic_delete('contact', id)"
79
+
80
+ def method_missing(method_called, *args, &block)
81
+ breakdown = method_called.to_s.split('_')
82
+ obj_type = breakdown.last.capitalize
83
+ case method_called.to_s
84
+ when /^delete_all_/
85
+ delete_all obj_type, *args
86
+ when /^delete_one/
87
+ delete obj_type, *args
88
+ when /^create_/
89
+ #TODO
90
+ else
91
+ super.method_missing
92
+ end
93
+ end
94
+
53
95
  end
54
96
  # INCLUDE HERE RATHER THAN IN THE PRODUCT-SPECIFIC CODE USING THIS GEM
55
97
  include SfdoAPI
@@ -1,5 +1,5 @@
1
1
  module SFDO
2
2
  module API
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
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.0
4
+ version: 0.1.1
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-03-04 00:00:00.000000000 Z
12
+ date: 2016-06-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -39,6 +39,20 @@ dependencies:
39
39
  - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '10.0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: pry
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - ">="
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :runtime
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
42
56
  - !ruby/object:Gem::Dependency
43
57
  name: restforce
44
58
  requirement: !ruby/object:Gem::Requirement