restforce-db 2.4.2 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d654a26f7dcf3a36b610fb1df64c96c1cb18cf0d
4
- data.tar.gz: 8d2bc3363eaddfc8b716368852d6d849da7b93ce
3
+ metadata.gz: 776100229186286c8c26c55b04ecd47ede80603c
4
+ data.tar.gz: 9e4478c44aff6fd877c35506212cc67db1901d50
5
5
  SHA512:
6
- metadata.gz: da5b6f83c431404f40886ece5ffc4cccdbe4a944b303d93ebfbb3768bc03da0ffddee231ff8679a1ac4268a9ef05bf693b087aecc9621edcd6dd8622f5a6f7ca
7
- data.tar.gz: 15500d13fa9004bc5714df6f54c8d1e5d2ed1ece3cc31a049afe05843064f83ee6c63a1743f67fdc273d16fc8059e423feff3d9d0e416046e09fb0bfd17a248f
6
+ metadata.gz: e7a6f574ba1b60141c3764c48cebb481fe62abe1050168b2e29a01bed4bc271c62c3fede9f86f807a19a2b89780d887338eda0c98d2e2062ec0541648cc70d5a
7
+ data.tar.gz: 1ae95cb2a150d27f49eccb35f843177e84dd91ef2f8672e602adbb99894e05139ca51406a96357310dfc0573b9ed52bc3fb94ddd213029438e7dd8379cf1eb2f
data/README.md CHANGED
@@ -22,6 +22,36 @@ First, you'll want to install the default bin and configuration files, which is
22
22
 
23
23
  This gem assumes that you're running Rails 4 or greater, therefore the `bin` file should be checked into the repository with the rest of your code. The `config/restforce-db.yml` file should be managed the same way you manage your secrets files, and probably not checked into the repository.
24
24
 
25
+ ### Modify your configurations
26
+
27
+ The following key-value pairs _must_ be set in your configuration file:
28
+
29
+ - `username`:
30
+ Your Salesforce username. Note that sandbox users typically have the name of the sandbox appended to their email address, e.g. "ahorner@tablexi.com.mysandbox".
31
+
32
+ - `password`:
33
+ Your Salesforce password.
34
+
35
+ - `security_token`:
36
+ Your Salesforce Security Token. If you didn't receive one in your email during setup, you can find this by signing in, and visiting Setup > Personal Information > Reset your security token.
37
+
38
+ - `client_id`, `client_secret`:
39
+ When signed in to Salesforce with the proper authorization level, navigate to Setup > App Setup > Create > Apps, and hit "New" for "Connected Apps" if no appropriate connected app has already been added. Enable OAuth settings for the app, and once it is created you should see the Consumer Key (Client ID) and Secret under the API settings for the app. If a connected app has already been created, you can simply grab the existing ID and Secret by clicking through.
40
+
41
+ - `host`:
42
+ This hostname of the Salesforce instance. You can typically use a more generic environment URL, e.g., "login.salesforce.com".
43
+
44
+ The following _can_ be set in your configuration file:
45
+
46
+ - `api_version`:
47
+ Restforce::DB defaults to version 29.0 of the Salesforce API. If you need a more (or less, for whatever reason) recent version of the API for your use case, you can specify an `api_version` key in your restforce-db.yml configuration. Version 29.0 or above is required for full gem functionality.
48
+
49
+ - `timeout`:
50
+ The maximum amount of time a request to Salesforce can take before it will be interrupted. This defaults to 5 seconds.
51
+
52
+ - `adapter`:
53
+ The HTTP adapter which should be used to make requests to Salesforce. By default, we use Net::HTTP (which is available by default in Ruby, and used by default through Faraday), but something like `typhoeus` may give better, more consistent performance for your use case. If you modify the configured adapter, be sure the relevant gem is available for your application.
54
+
25
55
  ### Update your model schema
26
56
 
27
57
  In order to keep your database records in sync with Salesforce, the table will need to store a reference to its associated Salesforce record. A generator is included to trivially add a generic `salesforce_id` column to your tables:
@@ -241,9 +271,6 @@ The example above would disable the default ActiveRecord logging specifically fo
241
271
  - **API Usage.**
242
272
  This gem performs most of its functionality via the Salesforce API (by way of the [`restforce`](https://github.com/ejholmes/restforce) gem). If you're at risk of hitting your Salesforce API limits, this may not be the right approach for you.
243
273
 
244
- - **API Version.**
245
- Restforce::DB defaults to version 29.0 of the Salesforce API. If you need a more (or less, for whatever reason) recent version of the API for your use case, you can specify an `api_version` key in your restforce-db.yml configuration. Version 29.0 or above is required for full gem functionality.
246
-
247
274
  - **Update Prioritization.**
248
275
  When synchronization occurs, the most recently updated record, Salesforce or database, gets to make the final call about the values of _all_ of the fields it observes. This means that race conditions can and probably will happen if both systems are updated within the same polling interval.
249
276
 
data/circle.yml CHANGED
@@ -17,4 +17,3 @@ test:
17
17
  override:
18
18
  - bundle exec rubocop
19
19
  - bundle exec rake test
20
-
@@ -6,3 +6,8 @@ client:
6
6
  client_id: "<your salesforce remote app client id>"
7
7
  client_secret: "<your salesforce remote app client secret>"
8
8
  host: "login.salesforce.com"
9
+
10
+ # The following are not required, but you may want to modify them:
11
+ api_version: "29.0"
12
+ timeout: 5
13
+ adapter: "net_http"
data/lib/restforce/db.rb CHANGED
@@ -91,7 +91,7 @@ module Restforce
91
91
  host: configuration.host,
92
92
  api_version: configuration.api_version,
93
93
  timeout: configuration.timeout,
94
- adapter: :net_http_persistent,
94
+ adapter: configuration.adapter,
95
95
  )
96
96
  end
97
97
 
@@ -9,7 +9,8 @@ module Restforce
9
9
  class Configuration
10
10
 
11
11
  DEFAULT_API_VERSION = "29.0".freeze
12
- DEFAULT_TIMEOUT = 5
12
+ DEFAULT_TIMEOUT = 5.freeze
13
+ DEFAULT_ADAPTER = :net_http.freeze
13
14
 
14
15
  attr_accessor(*%i(
15
16
  username
@@ -19,6 +20,7 @@ module Restforce
19
20
  client_secret
20
21
  host
21
22
  timeout
23
+ adapter
22
24
  api_version
23
25
  logger
24
26
  ))
@@ -76,6 +78,7 @@ module Restforce
76
78
  # endpoint for recently deleted records.
77
79
  self.api_version = configurations["api_version"] || DEFAULT_API_VERSION
78
80
  self.timeout = configurations["timeout"] || DEFAULT_TIMEOUT
81
+ self.adapter = (configurations["adapter"] || DEFAULT_ADAPTER).to_sym
79
82
  end
80
83
 
81
84
  private
@@ -3,7 +3,7 @@ module Restforce
3
3
  # :nodoc:
4
4
  module DB
5
5
 
6
- VERSION = "2.4.2"
6
+ VERSION = "2.5.0"
7
7
 
8
8
  end
9
9
 
data/restforce-db.gemspec CHANGED
@@ -26,7 +26,6 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency "activerecord"
28
28
  spec.add_dependency "daemons"
29
- spec.add_dependency "net-http-persistent"
30
29
  spec.add_dependency "restforce"
31
30
 
32
31
  spec.add_development_dependency "bundler"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: restforce-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.2
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Horner
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: net-http-persistent
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: restforce
57
43
  requirement: !ruby/object:Gem::Requirement