salesforce_connector 0.0.3 → 0.0.4

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.
data/lib/forcedotcom.rb CHANGED
@@ -11,8 +11,6 @@ module OmniAuth
11
11
  class Forcedotcom < OAuth2
12
12
  # Initialize the middleware
13
13
  #
14
- # @option options [Boolean, true] :sign_in When true, use a sign-in flow instead of the authorization flow.
15
- # @option options [Boolean, false] :mobile When true, use the mobile sign-in interface.
16
14
  def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
17
15
  client_options = {
18
16
  :site => "https://login.salesforce.com",
@@ -1,25 +1,11 @@
1
- require 'rubygems'
2
- require 'httparty'
3
-
4
1
  module SalesforceConnector
5
- class Account
6
- include HTTParty
2
+
3
+ class Account < OauthObject
7
4
  #doesn't seem to pick up env variable correctly if I set it here
8
5
  #headers 'Authorization' => "OAuth #{ENV['sfdc_token']}"
9
- format :json
10
- #debug_output $stderr
11
-
12
- def self.set_headers
13
- headers 'Authorization' => "OAuth #{ENV['sfdc_token']}"
14
- end
15
-
16
- def self.root_url
17
- @root_url = ENV['sfdc_instance_url']+"/services/data/v"+ENV['sfdc_api_version']
18
- end
19
6
 
20
7
  def self.get_first_hundred
21
- SalesforceConnector::Account.set_headers
22
- get(SalesforceConnector::Account.root_url+"/query/?q=#{CGI::escape('SELECT Name, Id from Account LIMIT 100')}")
8
+ Account.query('SELECT Name, Id from Account LIMIT 100')
23
9
  end
24
10
 
25
11
  def self.get_all_by_last_name(last_name)
@@ -0,0 +1,16 @@
1
+ module SalesforceConnector
2
+
3
+ class Contact < OauthObject
4
+ #doesn't seem to pick up env variable correctly if I set it here
5
+ #headers 'Authorization' => "OAuth #{ENV['sfdc_token']}"
6
+
7
+ def self.get_first_hundred
8
+ Contact.query('SELECT Name, Id from Contact LIMIT 100')
9
+ end
10
+
11
+ def self.get_all_by_last_name(last_name)
12
+ #TODO
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,16 @@
1
+ module SalesforceConnector
2
+
3
+ class Lead < OauthObject
4
+ #doesn't seem to pick up env variable correctly if I set it here
5
+ #headers 'Authorization' => "OAuth #{ENV['sfdc_token']}"
6
+
7
+ def self.get_first_hundred
8
+ Lead.query('SELECT Name, Id from Lead LIMIT 100')
9
+ end
10
+
11
+ def self.get_all_by_last_name(last_name)
12
+ #TODO
13
+ end
14
+ end
15
+ end
16
+
@@ -0,0 +1,23 @@
1
+ require 'httparty'
2
+
3
+ module SalesforceConnector
4
+ class OauthObject
5
+ include HTTParty
6
+ format :json
7
+
8
+ def self.set_headers
9
+ headers 'Authorization' => "OAuth #{ENV['sfdc_token']}"
10
+ end
11
+
12
+ def self.root_url
13
+ @root_url = ENV['sfdc_instance_url']+"/services/data/v"+ENV['sfdc_api_version']
14
+ end
15
+
16
+ def self.query(str)
17
+ self.set_headers
18
+ result = get(self.root_url+"/query/?q=#{CGI::escape(str)}")
19
+ return result.parsed_response["records"] || []
20
+ end
21
+
22
+ end
23
+ end
@@ -0,0 +1,16 @@
1
+ module SalesforceConnector
2
+
3
+ class Opportunity < OauthObject
4
+ #doesn't seem to pick up env variable correctly if I set it here
5
+ #headers 'Authorization' => "OAuth #{ENV['sfdc_token']}"
6
+
7
+ def self.get_first_hundred
8
+ Opportunity.query('SELECT Name, Id from Opportunity LIMIT 100')
9
+ end
10
+
11
+ def self.get_all_by_last_name(last_name)
12
+ #TODO
13
+ end
14
+ end
15
+ end
16
+
@@ -1,3 +1,3 @@
1
1
  module SalesforceConnector
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,4 +1,5 @@
1
1
  require "salesforce_connector/version"
2
+ require "salesforce_connector/oauth_object"
2
3
  require "salesforce_connector/account"
3
4
  require "forcedotcom"
4
5
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: salesforce_connector
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 3
10
- version: 0.0.3
9
+ - 4
10
+ version: 0.0.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Vzmind
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-08-06 00:00:00 Z
18
+ date: 2011-08-07 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: omniauth
@@ -66,6 +66,10 @@ files:
66
66
  - lib/forcedotcom.rb
67
67
  - lib/salesforce_connector.rb
68
68
  - lib/salesforce_connector/account.rb
69
+ - lib/salesforce_connector/contact.rb
70
+ - lib/salesforce_connector/lead.rb
71
+ - lib/salesforce_connector/oauth_object.rb
72
+ - lib/salesforce_connector/opportunity.rb
69
73
  - lib/salesforce_connector/version.rb
70
74
  - salesforce_connector.gemspec
71
75
  homepage: http://github.com/vzmind