databasedotcom 1.3.2 → 1.3.3

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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f3cfcbbf74adc330a0de947c6db6d90a970d9ac3
4
+ data.tar.gz: b13dbb0e20a9d466998046778ce86c475be0b4f0
5
+ SHA512:
6
+ metadata.gz: b5f49100c035ad7308867cd6f1f01de36bb1d924daa62cfaacec2132731a40e19ae48e8d3ce0b335025b114e3631b437a493050e1f42c515a39d47bb755287f6
7
+ data.tar.gz: f5e8d1d08d3fa739f3622172347689608eaa140aff7f793efe10c68483ec4a542349634d2824eff9d0c71ae57526c0af71fdc82299ce3d08dfe6ed2dc8638048
data/README.md CHANGED
@@ -240,6 +240,23 @@ me.follow(you) #=> start following a
240
240
 
241
241
  See the [documentation](http://rubydoc.info/github/heroku/databasedotcom/master/frames) for full details.
242
242
 
243
+ ## Running a Salesforce Flow
244
+ You can start Salesforce flows.
245
+
246
+ ```ruby
247
+ flow = Databasedotcom::Flow.new(client, flow_name, flow_paramaters)
248
+ flow.run
249
+ ```
250
+
251
+ Executing ```run``` will trigger a post to ```/services/data/v32.0/actions/custom/flow/#{@flow_name}``` with the passed in paramaters.
252
+
253
+ You can configure the API version with the ```:version``` option:
254
+
255
+ ```ruby
256
+ flow = Databasedotcom::Flow.new(client, flow_name, flow_paramaters, {:version => '33.0')
257
+ flow.run
258
+ ```
259
+
243
260
  # License
244
261
 
245
262
  This gem is licensed under the MIT License.
@@ -1,3 +1,4 @@
1
+ require 'active_support'
1
2
  require 'active_support/core_ext'
2
3
 
3
4
  require 'databasedotcom/version'
@@ -7,3 +8,4 @@ require 'databasedotcom/sales_force_error'
7
8
  require 'databasedotcom/collection'
8
9
  require 'databasedotcom/sobject'
9
10
  require 'databasedotcom/chatter'
11
+ require 'databasedotcom/flow'
@@ -0,0 +1,25 @@
1
+ module Databasedotcom
2
+ # A Salesforce API endpoint that can trigger predefinted flows in salesforce to kick off salesforce side processes.
3
+ # A flow can be triggered by its unique name and can be passed a hash of input variables.
4
+
5
+ class Flow
6
+ def initialize(client, flow_name, params = {}, options = {})
7
+ @client = client
8
+ @flow_name = flow_name
9
+ @params = params
10
+ @version = options[:version] || '32.0'
11
+ end
12
+
13
+ def run
14
+ params_hash = {inputs: [@params]}
15
+ @client.http_post(flow_url, params_hash.to_json)
16
+ end
17
+
18
+ protected
19
+
20
+ def flow_url
21
+ "/services/data/v#{@version}/actions/custom/flow/#{@flow_name}"
22
+ end
23
+ end
24
+ end
25
+
@@ -11,8 +11,13 @@ module Databasedotcom
11
11
  parsed_body = JSON.parse(response.body) rescue nil
12
12
  if parsed_body
13
13
  if parsed_body.is_a?(Array)
14
- message = parsed_body[0]["message"]
15
- self.error_code = parsed_body[0]["errorCode"]
14
+ if parsed_body[0]["errors"]
15
+ message = parsed_body[0]["errors"][0]["message"]
16
+ self.error_code = parsed_body[0]["errors"][0]["statusCode"]
17
+ else
18
+ message = parsed_body[0]["message"]
19
+ self.error_code = parsed_body[0]["errorCode"]
20
+ end
16
21
  else
17
22
  message = parsed_body["error_description"]
18
23
  self.error_code = parsed_body["error"]
@@ -1,3 +1,3 @@
1
1
  module Databasedotcom
2
- VERSION = "1.3.2"
2
+ VERSION = "1.3.3"
3
3
  end
metadata CHANGED
@@ -1,110 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databasedotcom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
5
- prerelease:
4
+ version: 1.3.3
6
5
  platform: ruby
7
6
  authors:
8
7
  - Glenn Gillen, Danny Burkes & Richard Zhao
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-12-27 00:00:00.000000000 Z
11
+ date: 2015-10-14 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: multipart-post
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '1.1'
19
+ version: 2.0.0
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '1.1'
26
+ version: 2.0.0
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: json
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
- - - ! '>='
31
+ - - ">="
36
32
  - !ruby/object:Gem::Version
37
33
  version: '0'
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
- - - ! '>='
38
+ - - ">="
44
39
  - !ruby/object:Gem::Version
45
40
  version: '0'
46
41
  - !ruby/object:Gem::Dependency
47
42
  name: activesupport
48
43
  requirement: !ruby/object:Gem::Requirement
49
- none: false
50
44
  requirements:
51
- - - ! '>='
45
+ - - ">="
52
46
  - !ruby/object:Gem::Version
53
47
  version: '0'
54
48
  type: :runtime
55
49
  prerelease: false
56
50
  version_requirements: !ruby/object:Gem::Requirement
57
- none: false
58
51
  requirements:
59
- - - ! '>='
52
+ - - ">="
60
53
  - !ruby/object:Gem::Version
61
54
  version: '0'
62
55
  - !ruby/object:Gem::Dependency
63
56
  name: rspec
64
57
  requirement: !ruby/object:Gem::Requirement
65
- none: false
66
58
  requirements:
67
- - - ~>
59
+ - - "~>"
68
60
  - !ruby/object:Gem::Version
69
61
  version: '2.6'
70
62
  type: :development
71
63
  prerelease: false
72
64
  version_requirements: !ruby/object:Gem::Requirement
73
- none: false
74
65
  requirements:
75
- - - ~>
66
+ - - "~>"
76
67
  - !ruby/object:Gem::Version
77
68
  version: '2.6'
78
69
  - !ruby/object:Gem::Dependency
79
70
  name: webmock
80
71
  requirement: !ruby/object:Gem::Requirement
81
- none: false
82
72
  requirements:
83
- - - ! '>='
73
+ - - ">="
84
74
  - !ruby/object:Gem::Version
85
75
  version: '0'
86
76
  type: :development
87
77
  prerelease: false
88
78
  version_requirements: !ruby/object:Gem::Requirement
89
- none: false
90
79
  requirements:
91
- - - ! '>='
80
+ - - ">="
92
81
  - !ruby/object:Gem::Version
93
82
  version: '0'
94
83
  - !ruby/object:Gem::Dependency
95
84
  name: rake
96
85
  requirement: !ruby/object:Gem::Requirement
97
- none: false
98
86
  requirements:
99
- - - ! '>='
87
+ - - ">="
100
88
  - !ruby/object:Gem::Version
101
89
  version: 0.8.6
102
90
  type: :development
103
91
  prerelease: false
104
92
  version_requirements: !ruby/object:Gem::Requirement
105
- none: false
106
93
  requirements:
107
- - - ! '>='
94
+ - - ">="
108
95
  - !ruby/object:Gem::Version
109
96
  version: 0.8.6
110
97
  description: A ruby wrapper for the Force.com REST API
@@ -114,8 +101,10 @@ executables: []
114
101
  extensions: []
115
102
  extra_rdoc_files: []
116
103
  files:
117
- - README.md
118
104
  - MIT-LICENSE
105
+ - README.md
106
+ - lib/databasedotcom.rb
107
+ - lib/databasedotcom/chatter.rb
119
108
  - lib/databasedotcom/chatter/comment.rb
120
109
  - lib/databasedotcom/chatter/conversation.rb
121
110
  - lib/databasedotcom/chatter/feed.rb
@@ -130,39 +119,38 @@ files:
130
119
  - lib/databasedotcom/chatter/record.rb
131
120
  - lib/databasedotcom/chatter/subscription.rb
132
121
  - lib/databasedotcom/chatter/user.rb
133
- - lib/databasedotcom/chatter.rb
134
122
  - lib/databasedotcom/client.rb
135
123
  - lib/databasedotcom/collection.rb
136
- - lib/databasedotcom/core_extensions/string_extensions.rb
137
124
  - lib/databasedotcom/core_extensions.rb
125
+ - lib/databasedotcom/core_extensions/string_extensions.rb
126
+ - lib/databasedotcom/flow.rb
138
127
  - lib/databasedotcom/sales_force_error.rb
139
- - lib/databasedotcom/sobject/sobject.rb
140
128
  - lib/databasedotcom/sobject.rb
129
+ - lib/databasedotcom/sobject/sobject.rb
141
130
  - lib/databasedotcom/version.rb
142
- - lib/databasedotcom.rb
143
131
  homepage: https://github.com/heroku/databasedotcom
144
- licenses: []
132
+ licenses:
133
+ - MIT
134
+ metadata: {}
145
135
  post_install_message:
146
136
  rdoc_options: []
147
137
  require_paths:
148
138
  - lib
149
139
  required_ruby_version: !ruby/object:Gem::Requirement
150
- none: false
151
140
  requirements:
152
- - - ! '>='
141
+ - - ">="
153
142
  - !ruby/object:Gem::Version
154
143
  version: '0'
155
144
  required_rubygems_version: !ruby/object:Gem::Requirement
156
- none: false
157
145
  requirements:
158
- - - ! '>='
146
+ - - ">="
159
147
  - !ruby/object:Gem::Version
160
148
  version: '0'
161
149
  requirements: []
162
150
  rubyforge_project: databasedotcom
163
- rubygems_version: 1.8.23
151
+ rubygems_version: 2.4.5.1
164
152
  signing_key:
165
- specification_version: 3
153
+ specification_version: 4
166
154
  summary: A ruby wrapper for the Force.com REST API
167
155
  test_files: []
168
156
  has_rdoc: