-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create_from_event method is removed and reg_meeting is added
- Loading branch information
Showing
3 changed files
with
88 additions
and
21 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 |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| class Sf::RegMeeting | ||
| include Sf::Base | ||
|
|
||
| def initialize(reg_meeting=nil) | ||
| @reg_meeting = reg_meeting.nil? ? Restforce::SObject.new(sobject_type: 'RegMeeting__c') : reg_meeting | ||
| end | ||
|
|
||
| def method_missing(method_name, *args, &block) | ||
| @reg_meeting.send(method_name, *args, &block) | ||
| end | ||
|
|
||
| def respond_to_missing?(method_name, include_private = false) | ||
| @reg_meeting.respond_to?(method_name, include_private) || super | ||
| end | ||
|
|
||
| def update(attrs = {}) | ||
| attrs['Id'] = self.Id | ||
| Sf.client.update("RegMeeting__c", attrs) | ||
| end | ||
|
|
||
| def self.find(id) | ||
| new Sf.client.find("RegMeeting__c", id) | ||
| end | ||
|
|
||
| def self.find_by_code(code) | ||
| found_meeting = where({code__c: code}).first | ||
| new Sf.client.find("RegMeeting__c", found_meeting.Id) unless found_meeting.nil? | ||
| end | ||
|
|
||
| def self.find_all_by_event_id(event_id) | ||
| found_meetings = where({reg_event_id__c: event_id}) | ||
| meetings = found_meetings.map do |meeting| | ||
| Sf.client.find("RegMeeting__c", meeting.Id) unless meeting.nil? | ||
| end | ||
| build_collection meetings | ||
| end | ||
|
|
||
| def self.where(args = {}) | ||
| where = args.map {|k,v| "#{k} = \'#{v}\'"}.join(" and ") | ||
| sobjects = Sf.client.query("select Id, Name from RegMeeting__c where #{where}") | ||
| build_collection sobjects unless sobjects.blank? | ||
| end | ||
|
|
||
| end | ||
|
|