forked from Internet2-TSG/sf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
728 additions
and
703 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,38 +1,41 @@ | ||
| class Sf::ContactAffiliation | ||
| include Sf::Base | ||
| API_NAME = 'Contact_Affiliation__c' | ||
| #FIELDS = [ | ||
| # 'Account__c', 'Contact__c', 'Contact_Email__c', 'Contact_Name__c', | ||
| # 'End_Date__c', 'Primary__c', 'Program__c', 'Role__c', 'Service__c', | ||
| # 'Status__c', 'Title__c' | ||
| #] | ||
| FIELDS = [ | ||
| 'Account__c', 'Contact__c', 'Contact_Email__c', 'Contact_Name__c', | ||
| 'Program__c', 'Role__c', 'Service__c', | ||
| 'Status__c', 'Title__c' | ||
| ] | ||
| FIELDS_SELECT_STR = FIELDS.join(', ') | ||
| # frozen_string_literal: true | ||
|
|
||
| def initialize(contact_affiliation = nil) | ||
| @contact_affiliation = contact_affiliation | ||
| end | ||
| module Sf | ||
| class ContactAffiliation | ||
| include Sf::Base | ||
| API_NAME = 'Contact_Affiliation__c' | ||
| # FIELDS = [ | ||
| # 'Account__c', 'Contact__c', 'Contact_Email__c', 'Contact_Name__c', | ||
| # 'End_Date__c', 'Primary__c', 'Program__c', 'Role__c', 'Service__c', | ||
| # 'Status__c', 'Title__c' | ||
| # ] | ||
| FIELDS = %w[ | ||
| Account__c Contact__c Contact_Email__c Contact_Name__c | ||
| Program__c Role__c Service__c | ||
| Status__c Title__c | ||
| ].freeze | ||
| FIELDS_SELECT_STR = FIELDS.join(', ') | ||
|
|
||
| def account | ||
| new Sf::Account.find("Account", Account__c) | ||
| end | ||
| def initialize(contact_affiliation = nil) | ||
| @contact_affiliation = contact_affiliation | ||
| end | ||
|
|
||
| def method_missing(method_name, *args, &block) | ||
| @contact_affiliation.send(method_name, *args, &block) | ||
| end | ||
| def account | ||
| new Sf::Account.find('Account', Account__c) | ||
| end | ||
|
|
||
| def respond_to_missing?(method_name, include_private = false) | ||
| @contact_affiliation.respond_to?(method_name, include_private) || super | ||
| end | ||
| def method_missing(method_name, *args, &block) | ||
| @contact_affiliation.send(method_name, *args, &block) | ||
| end | ||
|
|
||
| def respond_to_missing?(method_name, include_private = false) | ||
| @contact_affiliation.respond_to?(method_name, include_private) || super | ||
| end | ||
|
|
||
| def self.where(args = {}) | ||
| where = args.map {|k,v| "#{k} = \'#{v}\'"}.join(" and ") | ||
| sobjects = Sf.client.query("select #{FIELDS_SELECT_STR} from #{API_NAME} where #{where}") | ||
| build_collection sobjects unless sobjects.blank? | ||
| def self.where(args = {}) | ||
| where = args.map { |k, v| "#{k} = \'#{v}\'" }.join(' and ') | ||
| sobjects = Sf.client.query("select #{FIELDS_SELECT_STR} from #{API_NAME} where #{where}") | ||
| build_collection sobjects unless sobjects.blank? | ||
| end | ||
| end | ||
|
|
||
| end |
Oops, something went wrong.