metaforce 1.0.5 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -3
- data/lib/metaforce/client.rb +4 -0
- data/lib/metaforce/job/retrieve.rb +19 -9
- data/lib/metaforce/metadata/client.rb +4 -0
- data/lib/metaforce/services/client.rb +4 -0
- data/lib/metaforce/version.rb +1 -1
- data/spec/lib/client_spec.rb +5 -0
- metadata +2 -2
data/README.md
CHANGED
@@ -9,9 +9,17 @@ and [Services](http://www.salesforce.com/us/developer/docs/api/index.htm) APIs.
|
|
9
9
|
|
10
10
|
## Installation
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
gem 'metaforce'
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install metaforce
|
15
23
|
|
16
24
|
## Usage
|
17
25
|
|
data/lib/metaforce/client.rb
CHANGED
@@ -14,6 +14,10 @@ module Metaforce
|
|
14
14
|
@services ||= Metaforce::Services::Client.new(@options)
|
15
15
|
end
|
16
16
|
|
17
|
+
def inspect
|
18
|
+
"#<#{self.class} @options=#{@options.inspect}>"
|
19
|
+
end
|
20
|
+
|
17
21
|
def method_missing(method, *args, &block)
|
18
22
|
if metadata.respond_to? method, false
|
19
23
|
metadata.send(method, *args, &block)
|
@@ -64,27 +64,37 @@ module Metaforce
|
|
64
64
|
# Returns self.
|
65
65
|
def extract_to(destination)
|
66
66
|
return on_complete { |job| job.extract_to(destination) } unless started?
|
67
|
-
|
67
|
+
with_tmp_zip_file do |file|
|
68
|
+
unzip(file, destination)
|
69
|
+
end
|
70
|
+
self
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
# Internal: Unzips source to destination.
|
76
|
+
def unzip(source, destination)
|
77
|
+
Zip::ZipFile.open(source) do |zip|
|
68
78
|
zip.each do |f|
|
69
79
|
path = File.join(destination, f.name)
|
70
80
|
FileUtils.mkdir_p(File.dirname(path))
|
71
81
|
zip.extract(f, path) { true }
|
72
82
|
end
|
73
83
|
end
|
74
|
-
self
|
75
84
|
end
|
76
85
|
|
77
|
-
private
|
78
|
-
|
79
86
|
# Internal: Writes the zip file content to a temporary location so it can
|
80
87
|
# be extracted.
|
81
|
-
def
|
82
|
-
|
83
|
-
|
88
|
+
def with_tmp_zip_file
|
89
|
+
file = Tempfile.new('retrieve')
|
90
|
+
begin
|
91
|
+
file.binmode
|
84
92
|
file.write(zip_file)
|
85
|
-
|
93
|
+
file.rewind
|
94
|
+
yield file
|
95
|
+
ensure
|
86
96
|
file.close
|
87
|
-
|
97
|
+
file.unlink
|
88
98
|
end
|
89
99
|
end
|
90
100
|
|
data/lib/metaforce/version.rb
CHANGED
data/spec/lib/client_spec.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metaforce
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2013-
|
13
|
+
date: 2013-02-06 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: savon
|