restforce 2.1.3 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of restforce might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6856a7534599d3903698a710a379d2af99866a80
4
- data.tar.gz: 1d888bc1f8d088abd95361718b131b2111f7c693
3
+ metadata.gz: 5c96509bc04d200ffecb44942433ace9c40127ea
4
+ data.tar.gz: 71f6f9c56bb1834a9579efc527a11a40219a5268
5
5
  SHA512:
6
- metadata.gz: 98686516419562bc5ac3c2ca2748197d642373c5a508fc937921a00cfbec34ab835af2813acce8d95bd0595a8228a3b9fe26374d116f179bc0c9bfc70058f2db
7
- data.tar.gz: d67b50a3bc94beed337823ea61abb4e196ce0cd0eaa1c57818ff1e6791cb78737ac4554e28e16e6628d80dfec84c4732bba6e590b08d0ffb9d6f5afecf8cffea
6
+ metadata.gz: 52a228602bf185b74729c4b1b4655a1d1bf4752d094d14ca6d9fb582d9127a6f860e6638db1f23d9212db960abf74934cc418d859b2ce919ff0cd05539a78748
7
+ data.tar.gz: 1a2bd510e619a82f7912ec854c74f6cd595b1aa170ea1f0ab8bafe58c3ce8e76f99bc04294e5e4b33489f0a35a136ddc55dfae7ad6b8ca6dff504467bf52f33c
data/.travis.yml CHANGED
@@ -11,3 +11,4 @@ gemfile:
11
11
  script:
12
12
  - bundle exec rubocop
13
13
  - bundle exec rspec spec
14
+ sudo: false
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 2.2.0 (Mar 16, 2016)
2
+
3
+ * Raise a `Faraday::Error::ClientError` for `300` responses triggered by a conflicting external ID, providing access to the response, which contains an array of the conflicting IDs (@timrogers, @michaelminter)
4
+ * Improve the consistency of `Faraday::Error::ClientError`s raised, so they all have a message with the same format (@timrogers)
5
+
1
6
  ## 2.1.3 (Mar 9, 2016)
2
7
 
3
8
  * Raise a `Restforce::ServerError` when Salesforce responds with a `500` due to an internal error (@greysteil)
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the maintainer, Tim Rogers, at <me@timrogers.co.uk>. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,37 @@
1
+ # Contributing
2
+
3
+ We love pull requests from everyone. By participating in this project, you
4
+ agree to abide by our [code of conduct](https://github.com/ejholmes/restforce/blob/master/CODE_OF_CONDUCT.md).
5
+
6
+ Fork, then clone the repo:
7
+
8
+ git clone git@github.com:ejholmes/restforce.git
9
+
10
+ Set up your machine:
11
+
12
+ script/bootstrap
13
+
14
+ Play with the library by starting a console:
15
+
16
+ script/console
17
+
18
+ Make sure the tests pass:
19
+
20
+ script/test
21
+
22
+ Make your change. Add tests for your change. Make the tests pass:
23
+
24
+ script/test
25
+
26
+ Push to your fork and [submit a pull request](https://github.com/ejholmes/restforce/compare/).
27
+
28
+ At this point you're waiting on us. We like to at least comment on pull requests
29
+ within a few days. We may suggest
30
+ some changes or improvements or alternatives.
31
+
32
+ Some things that will increase the chance that your pull request is accepted:
33
+
34
+ * Write tests.
35
+ * Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
36
+
37
+ *Adapted from [factory_girl_rails's CONTRIBUTING.md](https://github.com/thoughtbot/factory_girl_rails/blob/master/CONTRIBUTING.md).*
data/README.md CHANGED
@@ -21,7 +21,7 @@ Features include:
21
21
  * Support for dependent picklists.
22
22
  * Support for decoding [Force.com Canvas](http://www.salesforce.com/us/developer/docs/platform_connectpre/canvas_framework.pdf) signed requests. (NEW!)
23
23
 
24
- [Documentation](http://rubydoc.info/gems/restforce/frames) | [Changelog](https://github.com/ejholmes/restforce/tree/master/CHANGELOG.md)
24
+ [Official Website](http://restforce.org/) | [Documentation](http://rubydoc.info/gems/restforce/frames) | [Changelog](https://github.com/ejholmes/restforce/tree/master/CHANGELOG.md)
25
25
 
26
26
  ## Installation
27
27
 
@@ -590,38 +590,14 @@ If you need a full Active Record experience, may be you can use
590
590
  Restforce and adds Associations, Query Building (like AREL), Validations and
591
591
  Callbacks.
592
592
 
593
- ## Development
594
-
595
- If you want to hack on Restforce locally, we try to make [bootstrapping the project](http://wynnnetherland.com/linked/2013012801/bootstrapping-consistency) as painless as possible. Just clone and run:
596
-
597
- ```bash
598
- $ script/bootstrap
599
- ```
600
-
601
- This will install project dependencies and get you up and running. If you want to run a Ruby console to poke on Restforce, you can crank one up with:
602
-
603
- ```bash
604
- $ script/console
605
- ```
606
-
607
- In order to run the specs, use:
608
-
609
- ```bash
610
- $ script/test
611
- ```
612
-
613
- Alternatively, use Guard which will run the specs on file changes:
614
-
615
- ```bash
616
- $ script/guard
617
- ```
593
+ ## Contributing
618
594
 
619
- Using the scripts in `./script` instead of `bundle exec rspec`, `bundle console`, etc. ensures your dependencies are up-to-date.
595
+ We welcome all contributions - they help us make Restforce the best gem possible.
620
596
 
621
- ## Contributing
597
+ See our [CONTRIBUTING.md](https://github.com/ejholmes/restforce/blob/master/CONTRIBUTING.md) file for help with getting set up to work on the project locally.
622
598
 
623
599
  1. Fork it
624
600
  2. Create your feature branch (`git checkout -b my-new-feature`)
625
601
  3. Commit your changes (`git commit -am 'Added some feature'`)
626
602
  4. Push to the branch (`git push origin my-new-feature`)
627
- 5. Create new Pull Request
603
+ 5. Create your Pull Request
@@ -315,7 +315,8 @@ module Restforce
315
315
  #
316
316
  # Returns true if the record was found and updated.
317
317
  # Returns the Id of the newly created record if the record was created.
318
- # Returns false if something bad happens.
318
+ # Returns false if something bad happens (for example if the external ID matches
319
+ # multiple resources).
319
320
  def upsert(*args)
320
321
  upsert!(*args)
321
322
  rescue *exceptions
@@ -335,7 +336,9 @@ module Restforce
335
336
  #
336
337
  # Returns true if the record was found and updated.
337
338
  # Returns the Id of the newly created record if the record was created.
338
- # Raises an exception if an error is returned from Salesforce.
339
+ # Raises an exception if an error is returned from Salesforce, including the 300
340
+ # error returned if the external ID provided matches multiple records (in which
341
+ # case the conflicting IDs can be found by looking at the response on the error)
339
342
  def upsert!(sobject, field, attrs)
340
343
  external_id = attrs.
341
344
  fetch(attrs.keys.find { |k, v| k.to_s.downcase == field.to_s.downcase }, nil)
@@ -3,12 +3,16 @@ module Restforce
3
3
  def on_complete(env)
4
4
  @env = env
5
5
  case env[:status]
6
- when 404
7
- raise Faraday::Error::ResourceNotFound, message
6
+ when 300
7
+ raise Faraday::Error::ClientError.new("300: The external ID provided matches " \
8
+ "more than one record",
9
+ response_values)
8
10
  when 401
9
11
  raise Restforce::UnauthorizedError, message
12
+ when 404
13
+ raise Faraday::Error::ResourceNotFound, message
10
14
  when 413
11
- raise Faraday::Error::ClientError.new("HTTP 413 - Request Entity Too Large",
15
+ raise Faraday::Error::ClientError.new("413: Request Entity Too Large",
12
16
  response_values)
13
17
  when 400...600
14
18
  raise Faraday::Error::ClientError.new(message, response_values)
@@ -1,3 +1,3 @@
1
1
  module Restforce
2
- VERSION = '2.1.3'
2
+ VERSION = '2.2.0'
3
3
  end
data/restforce.gemspec CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
6
6
  gem.email = ["eric@ejholmes.net", "tim@gocardless.com"]
7
7
  gem.description = %q{A lightweight ruby client for the Salesforce REST API.}
8
8
  gem.summary = %q{A lightweight ruby client for the Salesforce REST API.}
9
- gem.homepage = "https://github.com/ejholmes/restforce"
9
+ gem.homepage = "http://restforce.org/"
10
10
  gem.license = "MIT"
11
11
 
12
12
  gem.files = `git ls-files`.split($\)
@@ -17,6 +17,15 @@ describe Restforce::Middleware::RaiseError do
17
17
  end
18
18
  end
19
19
 
20
+ context 'when the status code is 300' do
21
+ let(:status) { 300 }
22
+
23
+ it "raises an error" do
24
+ expect { on_complete }.to raise_error Faraday::Error::ClientError,
25
+ /300: The external ID provided/
26
+ end
27
+ end
28
+
20
29
  context 'when the status code is 400' do
21
30
  let(:status) { 400 }
22
31
 
@@ -40,7 +49,7 @@ describe Restforce::Middleware::RaiseError do
40
49
 
41
50
  it "raises an error" do
42
51
  expect { on_complete }.to raise_error Faraday::Error::ClientError,
43
- 'HTTP 413 - Request Entity Too Large'
52
+ '413: Request Entity Too Large'
44
53
  end
45
54
  end
46
55
 
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.1.3
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric J. Holmes
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-03-09 00:00:00.000000000 Z
12
+ date: 2016-03-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday
@@ -162,6 +162,8 @@ files:
162
162
  - ".rubocop_todo.yml"
163
163
  - ".travis.yml"
164
164
  - CHANGELOG.md
165
+ - CODE_OF_CONDUCT.md
166
+ - CONTRIBUTING.md
165
167
  - Gemfile
166
168
  - Gemfile.travis
167
169
  - Guardfile
@@ -276,7 +278,7 @@ files:
276
278
  - spec/unit/signed_request_spec.rb
277
279
  - spec/unit/sobject_spec.rb
278
280
  - spec/unit/tooling/client_spec.rb
279
- homepage: https://github.com/ejholmes/restforce
281
+ homepage: http://restforce.org/
280
282
  licenses:
281
283
  - MIT
282
284
  metadata: {}