salesforce_http_client 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +5 -0
- data/README.md +35 -3
- data/lib/salesforce_http_client/salesforce_http_access.rb +10 -4
- data/lib/salesforce_http_client/version.rb +1 -1
- data/salesforce_http_client.gemspec +2 -2
- metadata +9 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9ba38a3ed0ffeaae870824b86c6e46a425cfe5d
|
4
|
+
data.tar.gz: cf30e390b6976ca3cd04a0ec4f94c1e2bb18ac5a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8398bf09ecc579cf7484244805fcb4dbfa54f6bc803b92328d877d54ef7d04af4da144e6f504434283656f3abbf516c34c292232e9ac32d99385ebcbcac73bd0
|
7
|
+
data.tar.gz: 7df72c5581ec65b09ebf6db1274c7bf5a1e8143242353ae731e9e005ea73e9fd5f4a638987783252f71a3fa7d73d5e68f28370b8496d1159d17bc27cf1843321
|
data/.gitignore
CHANGED
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# SalesforceHttpClient
|
2
2
|
|
3
|
-
|
3
|
+
This gem provides a simple way to download report data from salesforce.com.
|
4
|
+
It works well with any ruby applications, include such as Ruby on Rails.
|
5
|
+
|
6
|
+
You can access salesfore.com using only your sales force login id (=email) and password.
|
7
|
+
A security token is no need.
|
4
8
|
|
5
9
|
## Installation
|
6
10
|
|
@@ -16,9 +20,37 @@ Or install it yourself as:
|
|
16
20
|
|
17
21
|
$ gem install salesforce_http_client
|
18
22
|
|
19
|
-
##
|
23
|
+
## Configuring SalesforceHttpClient
|
24
|
+
|
25
|
+
Add configurations to set your salesforce.com login_id/password.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
SalesforceHttpClient.configure do |config|
|
29
|
+
config.salesforce_login_id = 'my_login_id_or_email'
|
30
|
+
config.salesforce_password = 'my_password'
|
31
|
+
end
|
32
|
+
```
|
33
|
+
|
34
|
+
If you're using Rails, create an initializer for this:
|
35
|
+
|
36
|
+
config/initializers/salesforce_http_client.rb
|
37
|
+
|
38
|
+
## Downloading report from salesforce.com
|
39
|
+
|
40
|
+
First, you need find the salesforce ID for your report.
|
41
|
+
For example: http://na1.salesforce.com/000000000000ABC, where '000000000000ABC' is the salesforce ID.
|
42
|
+
|
43
|
+
Then, pass the salesforce ID and a file path to SalesforceHttpClient::Client#download_report(salesforce_id, report_save_path) method.
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
salesforce_id = '000000000000ABC'
|
47
|
+
report_save_path = "tmp/#{salesforce_id}.csv"
|
48
|
+
|
49
|
+
sf_client = SalesforceHttpClient::Client.new
|
50
|
+
sf_client.download_report(salesforce_id, report_save_path)
|
51
|
+
```
|
20
52
|
|
21
|
-
|
53
|
+
After a few seconds, you will find your report data(csv format) at report_save_path.
|
22
54
|
|
23
55
|
## Contributing
|
24
56
|
|
@@ -35,15 +35,21 @@ module SalesforceHttpClient
|
|
35
35
|
@logger.info "begin download reports"
|
36
36
|
response = @http_client.get report_url(report_id)
|
37
37
|
if response.status == 200
|
38
|
-
|
39
|
-
report_file = output_save_path
|
40
|
-
@logger.info "save result to file #{report_file}"
|
41
|
-
File.write(report_file, report_content)
|
38
|
+
save_report(response, output_save_path)
|
42
39
|
else
|
43
40
|
@logger.error "failed to download reports."
|
44
41
|
end
|
45
42
|
end
|
46
43
|
|
44
|
+
def save_report(response, output_save_path)
|
45
|
+
report_content = response.content
|
46
|
+
report_file = output_save_path
|
47
|
+
@logger.info "save result to file #{report_file}"
|
48
|
+
|
49
|
+
FileUtils.mkdir_p(File.dirname(report_file))
|
50
|
+
File.write(report_file, report_content)
|
51
|
+
end
|
52
|
+
|
47
53
|
def salesforce_logout
|
48
54
|
@logger.info "try salesforce logout..."
|
49
55
|
@http_client.get config.salesforce_logout_url
|
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.version = SalesforceHttpClient::VERSION
|
9
9
|
spec.authors = ["Apuruni"]
|
10
10
|
spec.email = ["apuruni@gmail.com"]
|
11
|
-
spec.summary = "a
|
12
|
-
spec.description = "
|
11
|
+
spec.summary = "This gem provides a simple way to download report data from salesforce.com using only your sales force login id (=email) and password."
|
12
|
+
spec.description = "This gem provides a simple way to download report data from salesforce.com. It works well with any ruby applications, include such as Ruby on Rails.You can access salesfore.com using only your sales force login id (=email) and password. A security token is no need."
|
13
13
|
spec.homepage = "https://github.com/apuruni/salesforce_http_client"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salesforce_http_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Apuruni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -164,7 +164,10 @@ dependencies:
|
|
164
164
|
- - ">="
|
165
165
|
- !ruby/object:Gem::Version
|
166
166
|
version: '0'
|
167
|
-
description:
|
167
|
+
description: This gem provides a simple way to download report data from salesforce.com.
|
168
|
+
It works well with any ruby applications, include such as Ruby on Rails.You can
|
169
|
+
access salesfore.com using only your sales force login id (=email) and password.
|
170
|
+
A security token is no need.
|
168
171
|
email:
|
169
172
|
- apuruni@gmail.com
|
170
173
|
executables: []
|
@@ -174,6 +177,7 @@ files:
|
|
174
177
|
- ".gitignore"
|
175
178
|
- ".rspec"
|
176
179
|
- ".rubocop.yml"
|
180
|
+
- ".travis.yml"
|
177
181
|
- Gemfile
|
178
182
|
- Guardfile
|
179
183
|
- LICENSE.txt
|
@@ -213,7 +217,8 @@ rubyforge_project:
|
|
213
217
|
rubygems_version: 2.2.2
|
214
218
|
signing_key:
|
215
219
|
specification_version: 4
|
216
|
-
summary: a
|
220
|
+
summary: This gem provides a simple way to download report data from salesforce.com
|
221
|
+
using only your sales force login id (=email) and password.
|
217
222
|
test_files:
|
218
223
|
- spec/salesforce_http_client/client_spec.rb
|
219
224
|
- spec/salesforce_http_client/configuration_spec.rb
|