restforce 2.5.4 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/.circleci/config.yml +56 -0
  3. data/.rubocop.yml +18 -3
  4. data/.rubocop_todo.yml +8 -8
  5. data/CHANGELOG.md +12 -3
  6. data/CONTRIBUTING.md +3 -3
  7. data/Gemfile +4 -2
  8. data/Guardfile +3 -1
  9. data/LICENSE +1 -1
  10. data/README.md +22 -16
  11. data/Rakefile +2 -1
  12. data/lib/restforce.rb +2 -0
  13. data/lib/restforce/abstract_client.rb +2 -0
  14. data/lib/restforce/attachment.rb +2 -0
  15. data/lib/restforce/client.rb +2 -0
  16. data/lib/restforce/collection.rb +3 -1
  17. data/lib/restforce/concerns/api.rb +11 -8
  18. data/lib/restforce/concerns/authentication.rb +2 -0
  19. data/lib/restforce/concerns/base.rb +2 -0
  20. data/lib/restforce/concerns/caching.rb +4 -2
  21. data/lib/restforce/concerns/canvas.rb +2 -0
  22. data/lib/restforce/concerns/connection.rb +26 -20
  23. data/lib/restforce/concerns/picklists.rb +7 -5
  24. data/lib/restforce/concerns/streaming.rb +2 -0
  25. data/lib/restforce/concerns/verbs.rb +3 -1
  26. data/lib/restforce/config.rb +3 -1
  27. data/lib/restforce/data/client.rb +2 -0
  28. data/lib/restforce/document.rb +2 -0
  29. data/lib/restforce/mash.rb +2 -0
  30. data/lib/restforce/middleware.rb +2 -0
  31. data/lib/restforce/middleware/authentication.rb +8 -6
  32. data/lib/restforce/middleware/authentication/password.rb +2 -0
  33. data/lib/restforce/middleware/authentication/token.rb +2 -0
  34. data/lib/restforce/middleware/authorization.rb +3 -1
  35. data/lib/restforce/middleware/caching.rb +3 -1
  36. data/lib/restforce/middleware/custom_headers.rb +2 -0
  37. data/lib/restforce/middleware/gzip.rb +5 -3
  38. data/lib/restforce/middleware/instance_url.rb +7 -3
  39. data/lib/restforce/middleware/logger.rb +2 -0
  40. data/lib/restforce/middleware/mashify.rb +2 -0
  41. data/lib/restforce/middleware/multipart.rb +7 -4
  42. data/lib/restforce/middleware/raise_error.rb +2 -0
  43. data/lib/restforce/patches/parts.rb +2 -0
  44. data/lib/restforce/signed_request.rb +2 -0
  45. data/lib/restforce/sobject.rb +2 -0
  46. data/lib/restforce/tooling/client.rb +2 -0
  47. data/lib/restforce/upload_io.rb +2 -0
  48. data/lib/restforce/version.rb +3 -1
  49. data/restforce.gemspec +17 -10
  50. data/spec/fixtures/sobject/sobject_describe_success_response.json +48 -1
  51. data/spec/integration/abstract_client_spec.rb +9 -6
  52. data/spec/integration/data/client_spec.rb +24 -5
  53. data/spec/spec_helper.rb +2 -0
  54. data/spec/support/client_integration.rb +2 -0
  55. data/spec/support/concerns.rb +2 -0
  56. data/spec/support/event_machine.rb +2 -0
  57. data/spec/support/fixture_helpers.rb +2 -0
  58. data/spec/support/matchers.rb +2 -0
  59. data/spec/support/middleware.rb +3 -1
  60. data/spec/support/mock_cache.rb +4 -2
  61. data/spec/unit/abstract_client_spec.rb +2 -0
  62. data/spec/unit/attachment_spec.rb +2 -0
  63. data/spec/unit/collection_spec.rb +5 -3
  64. data/spec/unit/concerns/api_spec.rb +30 -11
  65. data/spec/unit/concerns/authentication_spec.rb +4 -2
  66. data/spec/unit/concerns/base_spec.rb +2 -0
  67. data/spec/unit/concerns/caching_spec.rb +2 -0
  68. data/spec/unit/concerns/canvas_spec.rb +3 -1
  69. data/spec/unit/concerns/connection_spec.rb +5 -3
  70. data/spec/unit/concerns/streaming_spec.rb +3 -1
  71. data/spec/unit/config_spec.rb +10 -8
  72. data/spec/unit/data/client_spec.rb +2 -0
  73. data/spec/unit/document_spec.rb +2 -0
  74. data/spec/unit/mash_spec.rb +3 -1
  75. data/spec/unit/middleware/authentication/password_spec.rb +2 -0
  76. data/spec/unit/middleware/authentication/token_spec.rb +2 -0
  77. data/spec/unit/middleware/authentication_spec.rb +3 -1
  78. data/spec/unit/middleware/authorization_spec.rb +2 -0
  79. data/spec/unit/middleware/custom_headers_spec.rb +3 -1
  80. data/spec/unit/middleware/gzip_spec.rb +4 -2
  81. data/spec/unit/middleware/instance_url_spec.rb +2 -0
  82. data/spec/unit/middleware/logger_spec.rb +2 -0
  83. data/spec/unit/middleware/mashify_spec.rb +3 -1
  84. data/spec/unit/middleware/raise_error_spec.rb +2 -0
  85. data/spec/unit/signed_request_spec.rb +2 -0
  86. data/spec/unit/sobject_spec.rb +5 -3
  87. data/spec/unit/tooling/client_spec.rb +2 -0
  88. metadata +35 -19
  89. data/.travis.yml +0 -16
  90. data/Gemfile.travis +0 -8
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Concerns::Connection do
@@ -34,7 +36,7 @@ describe Restforce::Concerns::Connection do
34
36
  describe 'with mashify not specified' do
35
37
  it 'includes the Mashify middleware' do
36
38
  client.middleware.handlers.index(Restforce::Middleware::Mashify).
37
- should_not be_nil
39
+ should_not be_nil
38
40
  end
39
41
  end
40
42
 
@@ -45,7 +47,7 @@ describe Restforce::Concerns::Connection do
45
47
 
46
48
  it 'includes the Mashify middleware' do
47
49
  client.middleware.handlers.index(Restforce::Middleware::Mashify).
48
- should_not be_nil
50
+ should_not be_nil
49
51
  end
50
52
  end
51
53
 
@@ -56,7 +58,7 @@ describe Restforce::Concerns::Connection do
56
58
 
57
59
  it 'does not include the Mashify middleware' do
58
60
  client.middleware.handlers.index(Restforce::Middleware::Mashify).
59
- should be_nil
61
+ should be_nil
60
62
  end
61
63
  end
62
64
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Concerns::Streaming, event_machine: true do
4
6
  describe '.subscribe' do
5
- let(:channels) { %w( channel1 channel2 ) }
7
+ let(:channels) { %w[channel1 channel2] }
6
8
  let(:topics) { channels.map { |c| "/topic/#{c}" } }
7
9
  let(:subscribe_block) { lambda { 'subscribe' } }
8
10
  let(:faye_double) { double('Faye') }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce do
@@ -25,9 +27,9 @@ describe Restforce do
25
27
  its(:authentication_retries) { should eq 3 }
26
28
  its(:adapter) { should eq Faraday.default_adapter }
27
29
  its(:ssl) { should eq({}) }
28
- [:username, :password, :security_token, :client_id, :client_secret,
29
- :oauth_token, :refresh_token, :instance_url, :compress, :timeout,
30
- :proxy_uri, :authentication_callback, :mashify, :request_headers].each do |attr|
30
+ %i[username password security_token client_id client_secret
31
+ oauth_token refresh_token instance_url compress timeout
32
+ proxy_uri authentication_callback mashify request_headers].each do |attr|
31
33
  its(attr) { should be_nil }
32
34
  end
33
35
  end
@@ -42,7 +44,7 @@ describe Restforce do
42
44
  'SALESFORCE_PROXY_URI' => 'proxy',
43
45
  'SALESFORCE_HOST' => 'test.host.com',
44
46
  'SALESFORCE_API_VERSION' => '37.0' }.
45
- each { |var, value| ENV.stub(:[]).with(var).and_return(value) }
47
+ each { |var, value| ENV.stub(:[]).with(var).and_return(value) }
46
48
  end
47
49
 
48
50
  its(:username) { should eq 'foo' }
@@ -57,10 +59,10 @@ describe Restforce do
57
59
  end
58
60
 
59
61
  describe '#configure' do
60
- [:username, :password, :security_token, :client_id, :client_secret, :compress,
61
- :timeout, :oauth_token, :refresh_token, :instance_url, :api_version, :host, :mashify,
62
- :authentication_retries, :proxy_uri, :authentication_callback, :ssl,
63
- :request_headers, :log_level, :logger].each do |attr|
62
+ %i[username password security_token client_id client_secret compress
63
+ timeout oauth_token refresh_token instance_url api_version host mashify
64
+ authentication_retries proxy_uri authentication_callback ssl
65
+ request_headers log_level logger].each do |attr|
64
66
  it "allows #{attr} to be set" do
65
67
  Restforce.configure do |config|
66
68
  config.send("#{attr}=", 'foobar')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Client do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Document do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Mash do
@@ -6,7 +8,7 @@ describe Restforce::Mash do
6
8
 
7
9
  context 'when array' do
8
10
  let(:input) { [{ foo: 'hello' }, { bar: 'world' }] }
9
- it { should be_all { |obj| expect(obj).to be_a Restforce::Mash } }
11
+ it { should(be_all { |obj| expect(obj).to be_a Restforce::Mash }) }
10
12
  end
11
13
  end
12
14
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Authentication::Password do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Authentication::Token do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Authentication do
@@ -58,7 +60,7 @@ describe Restforce::Middleware::Authentication do
58
60
  should include FaradayMiddleware::ParseJson,
59
61
  Faraday::Adapter::NetHttp
60
62
  }
61
- its(:handlers) { should_not include Restforce::Middleware::Logger }
63
+ its(:handlers) { should_not include Restforce::Middleware::Logger }
62
64
  end
63
65
 
64
66
  context 'with logging enabled' do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Authorization do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::CustomHeaders do
@@ -13,7 +15,7 @@ describe Restforce::Middleware::CustomHeaders do
13
15
  context 'when :request_headers are not a Hash' do
14
16
  let(:options) { { request_headers: 'bad header' } }
15
17
 
16
- it { should_not change { env[:request_headers] } }
18
+ it { should_not(change { env[:request_headers] }) }
17
19
  end
18
20
  end
19
21
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Gzip do
@@ -29,7 +31,7 @@ describe Restforce::Middleware::Gzip do
29
31
  end
30
32
 
31
33
  context 'when :compress is false' do
32
- it { should_not change { env[:request_headers]['Accept-Encoding'] } }
34
+ it { should_not(change { env[:request_headers]['Accept-Encoding'] }) }
33
35
  end
34
36
 
35
37
  context 'when :compress is true' do
@@ -37,7 +39,7 @@ describe Restforce::Middleware::Gzip do
37
39
  options[:compress] = true
38
40
  end
39
41
 
40
- it { should change { env[:request_headers]['Accept-Encoding'] }.to('gzip') }
42
+ it { should(change { env[:request_headers]['Accept-Encoding'] }.to('gzip')) }
41
43
  end
42
44
  end
43
45
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::InstanceURL do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Logger do
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::Mashify do
4
6
  let(:env) { { body: JSON.parse(fixture('sobject/query_success_response')) } }
5
7
  subject(:middleware) {
6
- described_class.new(lambda {|env|
8
+ described_class.new(lambda { |env|
7
9
  Faraday::Response.new(env)
8
10
  }, client, options)
9
11
  }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Middleware::RaiseError do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::SignedRequest do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::SObject do
@@ -22,8 +24,8 @@ describe Restforce::SObject do
22
24
  it { should be_a Restforce::Collection }
23
25
 
24
26
  describe 'each child' do
25
- it { should be_all { |sobject| expect(sobject).to be_a Restforce::SObject } }
26
- it { should be_all { |sobject| expect(sobject).to have_client client } }
27
+ it { should(be_all { |sobject| expect(sobject).to be_a Restforce::SObject }) }
28
+ it { should(be_all { |sobject| expect(sobject).to have_client client }) }
27
29
  end
28
30
  end
29
31
 
@@ -54,7 +56,7 @@ describe Restforce::SObject do
54
56
 
55
57
  context 'when an Id is present' do
56
58
  before do
57
- hash.merge!(Id: '001D000000INjVe')
59
+ hash[:Id] = '001D000000INjVe'
58
60
  client.should_receive(receiver)
59
61
  end
60
62
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'spec_helper'
2
4
 
3
5
  describe Restforce::Tooling::Client do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.4
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric J. Holmes
@@ -9,28 +9,28 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-05-15 00:00:00.000000000 Z
12
+ date: 2018-08-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ">="
19
- - !ruby/object:Gem::Version
20
- version: 0.9.0
21
18
  - - "<="
22
19
  - !ruby/object:Gem::Version
23
20
  version: '1.0'
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.0
24
24
  type: :runtime
25
25
  prerelease: false
26
26
  version_requirements: !ruby/object:Gem::Requirement
27
27
  requirements:
28
- - - ">="
29
- - !ruby/object:Gem::Version
30
- version: 0.9.0
31
28
  - - "<="
32
29
  - !ruby/object:Gem::Version
33
30
  version: '1.0'
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.9.0
34
34
  - !ruby/object:Gem::Dependency
35
35
  name: faraday_middleware
36
36
  requirement: !ruby/object:Gem::Requirement
@@ -105,42 +105,56 @@ dependencies:
105
105
  requirements:
106
106
  - - "~>"
107
107
  - !ruby/object:Gem::Version
108
- version: 1.13.0
108
+ version: 3.4.0
109
109
  type: :development
110
110
  prerelease: false
111
111
  version_requirements: !ruby/object:Gem::Requirement
112
112
  requirements:
113
113
  - - "~>"
114
114
  - !ruby/object:Gem::Version
115
- version: 1.13.0
115
+ version: 3.4.0
116
116
  - !ruby/object:Gem::Dependency
117
117
  name: simplecov
118
118
  requirement: !ruby/object:Gem::Requirement
119
119
  requirements:
120
120
  - - "~>"
121
121
  - !ruby/object:Gem::Version
122
- version: 0.7.1
122
+ version: 0.15.0
123
123
  type: :development
124
124
  prerelease: false
125
125
  version_requirements: !ruby/object:Gem::Requirement
126
126
  requirements:
127
127
  - - "~>"
128
128
  - !ruby/object:Gem::Version
129
- version: 0.7.1
129
+ version: 0.15.0
130
130
  - !ruby/object:Gem::Dependency
131
131
  name: rubocop
132
132
  requirement: !ruby/object:Gem::Requirement
133
133
  requirements:
134
134
  - - "~>"
135
135
  - !ruby/object:Gem::Version
136
- version: 0.31.0
136
+ version: 0.50.0
137
+ type: :development
138
+ prerelease: false
139
+ version_requirements: !ruby/object:Gem::Requirement
140
+ requirements:
141
+ - - "~>"
142
+ - !ruby/object:Gem::Version
143
+ version: 0.50.0
144
+ - !ruby/object:Gem::Dependency
145
+ name: rspec_junit_formatter
146
+ requirement: !ruby/object:Gem::Requirement
147
+ requirements:
148
+ - - "~>"
149
+ - !ruby/object:Gem::Version
150
+ version: 0.3.0
137
151
  type: :development
138
152
  prerelease: false
139
153
  version_requirements: !ruby/object:Gem::Requirement
140
154
  requirements:
141
155
  - - "~>"
142
156
  - !ruby/object:Gem::Version
143
- version: 0.31.0
157
+ version: 0.3.0
144
158
  - !ruby/object:Gem::Dependency
145
159
  name: faye
146
160
  requirement: !ruby/object:Gem::Requirement
@@ -163,15 +177,14 @@ executables: []
163
177
  extensions: []
164
178
  extra_rdoc_files: []
165
179
  files:
180
+ - ".circleci/config.yml"
166
181
  - ".gitignore"
167
182
  - ".rubocop.yml"
168
183
  - ".rubocop_todo.yml"
169
- - ".travis.yml"
170
184
  - CHANGELOG.md
171
185
  - CODE_OF_CONDUCT.md
172
186
  - CONTRIBUTING.md
173
187
  - Gemfile
174
- - Gemfile.travis
175
188
  - Guardfile
176
189
  - LICENSE
177
190
  - README.md
@@ -292,7 +305,9 @@ files:
292
305
  homepage: http://restforce.org/
293
306
  licenses:
294
307
  - MIT
295
- metadata: {}
308
+ metadata:
309
+ source_code_uri: https://github.com/restforce/restforce
310
+ changelog_uri: https://github.com/restforce/restforce/blob/master/CHANGELOG.md
296
311
  post_install_message:
297
312
  rdoc_options: []
298
313
  require_paths:
@@ -301,14 +316,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
301
316
  requirements:
302
317
  - - ">="
303
318
  - !ruby/object:Gem::Version
304
- version: '2.0'
319
+ version: '2.3'
305
320
  required_rubygems_version: !ruby/object:Gem::Requirement
306
321
  requirements:
307
322
  - - ">="
308
323
  - !ruby/object:Gem::Version
309
324
  version: '0'
310
325
  requirements: []
311
- rubygems_version: 3.0.3
326
+ rubyforge_project:
327
+ rubygems_version: 2.6.14.1
312
328
  signing_key:
313
329
  specification_version: 4
314
330
  summary: A lightweight ruby client for the Salesforce REST API.
@@ -1,16 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1
5
- - 2.2
6
- - 2.3.1
7
- - ruby-2.4.0
8
- gemfile:
9
- - Gemfile.travis
10
- script:
11
- - bundle exec rubocop
12
- - bundle exec rspec spec
13
- sudo: false
14
- before_install:
15
- - gem update --system
16
- - gem update bundler
@@ -1,8 +0,0 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem 'rake'
5
- gem 'rack', '~> 1.6.4'
6
- gem 'faraday', '~> 0.11.0'
7
- gem 'jruby-openssl', :platforms => :jruby
8
- gem 'public_suffix', '2.0.3'