salesforce-rails 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.coveralls.yml +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +4 -0
- data/README.md +7 -2
- data/lib/salesforce/rails/api/calendar_event.rb +2 -2
- data/lib/salesforce/rails/api/client.rb +1 -1
- data/lib/salesforce/rails/version.rb +1 -1
- data/salesforce-rails.gemspec +5 -4
- data/spec/{fixtures → config}/salesforce.yml +0 -0
- data/spec/lib/salesforce/rails/api/calendar_event_spec.rb +1 -1
- data/spec/lib/salesforce/rails/api/client_spec.rb +10 -4
- data/spec/spec_helper.rb +3 -0
- metadata +10 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7775f947ae5585393c6c39e2c4a8f4616b8020d
|
4
|
+
data.tar.gz: 3a4e863e030c23a3369853671d308b008ecbee06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 101469f840e5cc83314efa2d4a0fc7af064cd97b67bc339509c898429a364f23a30f627d99c052eca536ff62ee7fcdc8f365fb8841d00f68d370a7f9281471ac
|
7
|
+
data.tar.gz: 145fa8f54c3a32f353112e8ae99a69e791becaa195411216f0ff090887e0e358f7ac9891c7f5f3850a151bad3d4b4feae2faa71e983442904ed4e04b6ad26e64
|
data/.coveralls.yml
ADDED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Salesforce::Rails
|
2
2
|
|
3
|
-
[](http://badge.fury.io/rb/salesforce-rails) [](https://travis-ci.org/dark-prince/salesforce-rails) [](https://codeclimate.com/github/dark-prince/salesforce-rails) [](https://gemnasium.com/dark-prince/salesforce-rails) [](http://badge.fury.io/rb/salesforce-rails) [](https://travis-ci.org/dark-prince/salesforce-rails) [](https://codeclimate.com/github/dark-prince/salesforce-rails) [](https://gemnasium.com/dark-prince/salesforce-rails) [](http://opensource.org/licenses/MIT) [](https://coveralls.io/r/dark-prince/salesforce-rails?branch=master)
|
4
4
|
|
5
5
|
salesforce_rails is a gem to access salesforce calender in rails application much more easier. If you use bundler, simply list it in your Gemfile, like so:
|
6
6
|
|
@@ -45,4 +45,9 @@ And open browser and type [http://localhost:3000/calendar](http://localhost:3000
|
|
45
45
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
46
46
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
47
47
|
4. Push to the branch (`git push origin my-new-feature`)
|
48
|
-
5.
|
48
|
+
5. Make sure there are tests! I will not accept any patch that is not tested. It's a rare time when explicit tests are not needed. If you have questions about writing tests for salesforce_rails, please open a [GitHub issue](https://github.com/dark-prince/salesforce-rails/issues/new).
|
49
|
+
6. Create a new Pull Request
|
50
|
+
|
51
|
+
## License
|
52
|
+
|
53
|
+
Salesforce::Rails is Copyright (c) 2014 Diganta Mandal. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.
|
@@ -7,14 +7,14 @@ module Salesforce
|
|
7
7
|
class << self
|
8
8
|
# Returns all calendar events.
|
9
9
|
#
|
10
|
-
# Salesforce::Rails::API::
|
10
|
+
# Salesforce::Rails::API::CalendarEvent.all #=> [#<Event @Id="1", ...>, #<Event @Id="2", ...>, #<Event @Id="3", ...>, ...]
|
11
11
|
def all
|
12
12
|
client.query("SELECT Id, Subject, IsAllDayEvent, StartDateTime, EndDateTime, Description, Owner.Name, ShowAs FROM Event")
|
13
13
|
end
|
14
14
|
|
15
15
|
# Returns a collection of events of self that match the conditional +where_expr+, which is the WHERE part of a SOQL query.
|
16
16
|
#
|
17
|
-
# Salesforce::Rails::API::
|
17
|
+
# Salesforce::Rails::API::CalendarEvent.query("Name = 'test'") #=> [#<Event @Id="1", @Name="test", ...>, #<Event @Id="2", @Name="test", ...>, #<Event @Id="3", @Name="test", ...>, ...]
|
18
18
|
def query(where_expr)
|
19
19
|
client.query("SELECT Id, Subject, IsAllDayEvent, StartDateTime, EndDateTime, Description, Owner.Name, ShowAs FROM Event WHERE #{where_expr}")
|
20
20
|
end
|
@@ -5,7 +5,7 @@ module Salesforce
|
|
5
5
|
module ClassMethods
|
6
6
|
def client
|
7
7
|
unless @client
|
8
|
-
config = YAML.
|
8
|
+
config = YAML.load(ERB.new(File.new(File.join(::Rails.root, 'config', 'salesforce.yml')).read).result)
|
9
9
|
config = config.has_key?(::Rails.env) ? config[::Rails.env] : config
|
10
10
|
username = config["username"]
|
11
11
|
password = config["password"]
|
data/salesforce-rails.gemspec
CHANGED
@@ -8,26 +8,27 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.name = "salesforce-rails"
|
9
9
|
spec.version = Salesforce::Rails::VERSION
|
10
10
|
spec.platform = Gem::Platform::RUBY
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
11
13
|
spec.authors = ["Diganta Mandal"]
|
12
14
|
spec.email = ["diganta@emerchantpay.com"]
|
13
15
|
spec.summary = %q{Convenience classes to make using the salesforce calender events with Rails apps even easier.}
|
14
16
|
spec.description = %q{Convenience classes to make using the salesforce calender events with Rails apps even easier.}
|
15
17
|
spec.homepage = "https://github.com/dark-prince/salesforce-rails"
|
16
|
-
spec.license = "MIT"
|
17
18
|
|
18
19
|
spec.files = `git ls-files -z`.split("\x0")
|
19
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
21
22
|
spec.require_paths = ["lib"]
|
22
23
|
|
23
|
-
spec.
|
24
|
+
spec.required_ruby_version = ">= 1.9.3"
|
25
|
+
|
26
|
+
spec.add_dependency "databasedotcom", "~> 1.3.0"
|
24
27
|
spec.add_dependency "railties", rails_version
|
25
28
|
spec.add_dependency "actionpack", rails_version
|
26
29
|
spec.add_dependency "thor", ">= 0.14", "< 2.0"
|
27
|
-
|
28
30
|
spec.add_development_dependency "bundler", "~> 1.6"
|
29
31
|
spec.add_development_dependency "rake"
|
30
32
|
spec.add_development_dependency "rspec", "~> 3.0"
|
31
|
-
|
32
33
|
spec.add_runtime_dependency "rails", rails_version
|
33
34
|
end
|
File without changes
|
@@ -5,7 +5,7 @@ RSpec.describe Salesforce::Rails::API::CalendarEvent do
|
|
5
5
|
end
|
6
6
|
|
7
7
|
before do
|
8
|
-
config = YAML.
|
8
|
+
config = YAML.load(ERB.new(File.new(File.join(::Rails.root, 'config', 'salesforce.yml')).read).result)
|
9
9
|
config = config.has_key?(::Rails.env) ? config[::Rails.env] : config
|
10
10
|
token = config["token"]
|
11
11
|
instance_url = config["instance_url"]
|
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Salesforce::Rails::API::Client do
|
3
|
+
RSpec.describe Salesforce::Rails::API::Client do
|
4
4
|
class TestClass
|
5
5
|
include Salesforce::Rails::API::Client
|
6
6
|
end
|
@@ -18,10 +18,11 @@ describe Salesforce::Rails::API::Client do
|
|
18
18
|
:production => { "client_id" => "production_client_id", "client_secret" => "production_client_secret", "username" => "production_user", "password" => "production_password" }
|
19
19
|
}
|
20
20
|
|
21
|
-
expect(YAML).to receive(:
|
21
|
+
expect(YAML).to receive(:load).and_return(config_hash)
|
22
22
|
::Rails.stub(:env).and_return(:production)
|
23
23
|
|
24
24
|
expect_any_instance_of(Databasedotcom::Client).to receive(:authenticate).with(:username => "production_user", :password => "production_password")
|
25
|
+
|
25
26
|
TestClass.client
|
26
27
|
end
|
27
28
|
end
|
@@ -30,8 +31,10 @@ describe Salesforce::Rails::API::Client do
|
|
30
31
|
it "should use the top level config" do
|
31
32
|
conf_hash = { "client_id" => "client_id", "client_secret" => "client_secret", "username" => "production_user", "password" => "production_password" }
|
32
33
|
::Rails.stub(:env).and_return(:production)
|
33
|
-
|
34
|
+
|
35
|
+
expect(YAML).to receive(:load).and_return(conf_hash)
|
34
36
|
expect_any_instance_of(Databasedotcom::Client).to receive(:authenticate).with(:username => "production_user", :password => "production_password")
|
37
|
+
|
35
38
|
TestClass.client
|
36
39
|
end
|
37
40
|
end
|
@@ -39,17 +42,20 @@ describe Salesforce::Rails::API::Client do
|
|
39
42
|
describe "test_user" do
|
40
43
|
before(:each) do
|
41
44
|
config_hash = { "client_id" => "client_id", "client_secret" => "client_secret", "username" => "test_user", "password" => "test_password" }
|
42
|
-
expect(YAML).to receive(:
|
45
|
+
expect(YAML).to receive(:load).and_return(config_hash)
|
46
|
+
|
43
47
|
::Rails.stub(:env).and_return(:test)
|
44
48
|
end
|
45
49
|
|
46
50
|
it "constructs and authenticates a Databasedotcom::Client" do
|
47
51
|
expect_any_instance_of(Databasedotcom::Client).to receive(:authenticate).with(:username => "test_user", :password => "test_password")
|
52
|
+
|
48
53
|
TestClass.client
|
49
54
|
end
|
50
55
|
|
51
56
|
it "is memoized" do
|
52
57
|
expect_any_instance_of(Databasedotcom::Client).to receive(:authenticate).exactly(1).times.with(:username => "test_user", :password => "test_password")
|
58
|
+
|
53
59
|
TestClass.client
|
54
60
|
TestClass.client
|
55
61
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: salesforce-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Diganta Mandal
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: databasedotcom
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 1.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 1.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: railties
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -154,6 +154,7 @@ executables: []
|
|
154
154
|
extensions: []
|
155
155
|
extra_rdoc_files: []
|
156
156
|
files:
|
157
|
+
- ".coveralls.yml"
|
157
158
|
- ".gitignore"
|
158
159
|
- ".rspec"
|
159
160
|
- ".travis.yml"
|
@@ -181,7 +182,7 @@ files:
|
|
181
182
|
- lib/salesforce/rails/engine.rb
|
182
183
|
- lib/salesforce/rails/version.rb
|
183
184
|
- salesforce-rails.gemspec
|
184
|
-
- spec/
|
185
|
+
- spec/config/salesforce.yml
|
185
186
|
- spec/lib/salesforce/rails/api/calendar_event_spec.rb
|
186
187
|
- spec/lib/salesforce/rails/api/client_spec.rb
|
187
188
|
- spec/rails_mocks.rb
|
@@ -198,7 +199,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
198
199
|
requirements:
|
199
200
|
- - ">="
|
200
201
|
- !ruby/object:Gem::Version
|
201
|
-
version:
|
202
|
+
version: 1.9.3
|
202
203
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
204
|
requirements:
|
204
205
|
- - ">="
|
@@ -212,7 +213,7 @@ specification_version: 4
|
|
212
213
|
summary: Convenience classes to make using the salesforce calender events with Rails
|
213
214
|
apps even easier.
|
214
215
|
test_files:
|
215
|
-
- spec/
|
216
|
+
- spec/config/salesforce.yml
|
216
217
|
- spec/lib/salesforce/rails/api/calendar_event_spec.rb
|
217
218
|
- spec/lib/salesforce/rails/api/client_spec.rb
|
218
219
|
- spec/rails_mocks.rb
|