Class: MoxiworksPlatform::Team
- Defined in:
- lib/moxiworks_platform/team.rb
Overview
Moxi Works Platform Teams
Instance Attribute Summary collapse
-
#active ⇒ Object
Boolean Whether the team is active or not.
-
#address1 ⇒ Object
String First line of contact address for the team.
-
#address2 ⇒ Object
String Second line of contact address for the team.
-
#alt_email ⇒ Object
String Alternate contact email address for the team.
-
#alt_phone ⇒ Object
String Alternate contact phone number for the team.
-
#city ⇒ Object
String City portion of contact address for the team.
-
#description ⇒ Object
String Description of the team.
-
#email ⇒ Object
String Contact email address for the team.
-
#fax ⇒ Object
String fax number for the team.
-
#logo_url ⇒ Object
String URL to a logo image for the team.
-
#name ⇒ Object
String The human readable name of the team.
-
#phone ⇒ Object
String contact phone number for the team.
-
#photo_url ⇒ Object
String First URL to a image representing the team.
-
#social_media_urls ⇒ Object
Array Social media URLs associated with the team.
-
#state ⇒ Object
String State portion of contact address for the team.
-
#uuid ⇒ Object
String The unique ID of the Team.
-
#website_url ⇒ Object
String URL to the website for the team.
-
#zipcode ⇒ Object
String Postal Code portion of the contact address for the team.
Attributes inherited from Resource
Class Method Summary collapse
-
.find(opts = {}) ⇒ MoxiworksPlatform::Team
Find a Team by ID in Moxi Works Platform.
-
.search(opts = {}) ⇒ Array
Search For Teams in Moxi Works Platform.
Methods inherited from Resource
accept_header, attr_accessor, attributes, #attributes, auth_header, check_for_error_in_response, content_type_header, #float_attrs, headers, #init_attrs_from_hash, #initialize, #int_attrs, #method_missing, #numeric_attrs, #numeric_value_for, send_request, #to_hash, underscore, underscore_array, underscore_attribute_names, underscore_hash, user_agent_header
Constructor Details
This class inherits a constructor from MoxiworksPlatform::Resource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class MoxiworksPlatform::Resource
Instance Attribute Details
#active ⇒ Object
Returns boolean Whether the team is active or not.
129 130 131 |
# File 'lib/moxiworks_platform/team.rb', line 129 def active @active end |
#address1 ⇒ Object
Returns string First line of contact address for the team.
31 32 33 |
# File 'lib/moxiworks_platform/team.rb', line 31 def address1 @address1 end |
#address2 ⇒ Object
Returns string Second line of contact address for the team.
38 39 40 |
# File 'lib/moxiworks_platform/team.rb', line 38 def address2 @address2 end |
#alt_email ⇒ Object
Returns string Alternate contact email address for the team.
115 116 117 |
# File 'lib/moxiworks_platform/team.rb', line 115 def alt_email @alt_email end |
#alt_phone ⇒ Object
Returns string Alternate contact phone number for the team.
108 109 110 |
# File 'lib/moxiworks_platform/team.rb', line 108 def alt_phone @alt_phone end |
#city ⇒ Object
Returns string City portion of contact address for the team.
45 46 47 |
# File 'lib/moxiworks_platform/team.rb', line 45 def city @city end |
#description ⇒ Object
Returns string Description of the team. can contain embedded HTML.
94 95 96 |
# File 'lib/moxiworks_platform/team.rb', line 94 def description @description end |
#email ⇒ Object
Returns string Contact email address for the team.
24 25 26 |
# File 'lib/moxiworks_platform/team.rb', line 24 def email @email end |
#fax ⇒ Object
Returns string fax number for the team.
73 74 75 |
# File 'lib/moxiworks_platform/team.rb', line 73 def fax @fax end |
#logo_url ⇒ Object
Returns string URL to a logo image for the team.
80 81 82 |
# File 'lib/moxiworks_platform/team.rb', line 80 def logo_url @logo_url end |
#name ⇒ Object
Returns string The human readable name of the team.
17 18 19 |
# File 'lib/moxiworks_platform/team.rb', line 17 def name @name end |
#phone ⇒ Object
Returns string contact phone number for the team.
66 67 68 |
# File 'lib/moxiworks_platform/team.rb', line 66 def phone @phone end |
#photo_url ⇒ Object
Returns string First URL to a image representing the team.
87 88 89 |
# File 'lib/moxiworks_platform/team.rb', line 87 def photo_url @photo_url end |
#social_media_urls ⇒ Object
Returns array Social media URLs associated with the team.
101 102 103 |
# File 'lib/moxiworks_platform/team.rb', line 101 def @social_media_urls end |
#state ⇒ Object
Returns string State portion of contact address for the team.
52 53 54 |
# File 'lib/moxiworks_platform/team.rb', line 52 def state @state end |
#uuid ⇒ Object
Returns string The unique ID of the Team.
10 11 12 |
# File 'lib/moxiworks_platform/team.rb', line 10 def uuid @uuid end |
#website_url ⇒ Object
Returns string URL to the website for the team.
122 123 124 |
# File 'lib/moxiworks_platform/team.rb', line 122 def website_url @website_url end |
#zipcode ⇒ Object
Returns string Postal Code portion of the contact address for the team.
59 60 61 |
# File 'lib/moxiworks_platform/team.rb', line 59 def zipcode @zipcode end |
Class Method Details
.find(opts = {}) ⇒ MoxiworksPlatform::Team
Find a Team by ID in Moxi Works Platform
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/moxiworks_platform/team.rb', line 140 def self.find(opts={}) raise ::MoxiworksPlatform::Exception::ArgumentError, 'arguments must be passed as named parameters' unless opts.is_a? Hash required_opts = [:moxi_works_team_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end url = "#{MoxiworksPlatform::Config.url}/api/teams/#{opts[:moxi_works_team_id]}" self.send_request(:get, opts, url) end |
.search(opts = {}) ⇒ Array
Search For Teams in Moxi Works Platform
180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 |
# File 'lib/moxiworks_platform/team.rb', line 180 def self.search(opts={}) required_opts = [:moxi_works_company_id] required_opts.each do |opt| raise ::MoxiworksPlatform::Exception::ArgumentError, "#{opt} required" if opts[opt].nil? or opts[opt].to_s.empty? end url = "#{MoxiworksPlatform::Config.url}/api/teams" results = MoxiResponseArray.new() RestClient::Request.execute(method: :get, url: url, payload: opts, headers: self.headers) do |response| puts response if MoxiworksPlatform::Config.debug results.headers = response.headers self.check_for_error_in_response(response) json = JSON.parse(response) json = self.underscore_attribute_names json results.page_number = 1 results.total_pages = 1 json.each do |r| results << MoxiworksPlatform::Team.new(r) unless r.nil? or r.empty? end end if block_given? yield(results) end results end |