Class: SparkApi::Models::AccountReport

Inherits:
Account show all
Defined in:
lib/spark_api/models/account_report.rb

Constant Summary

Constants inherited from Account

SparkApi::Models::Account::SUBELEMENTS

Constants included from Paginate

Paginate::DEFAULT_PAGE_SIZE

Instance Attribute Summary

Attributes inherited from Base

#attributes, #errors, #parent

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Account

by_office, #initialize, my, #my_account?, #primary_img, #save, #save!

Methods included from Finders

#find, #find_one, #first, #last

Methods inherited from Base

connection, #connection, count, element_name, element_name=, first, get, #id, #initialize, #load, #method_missing, #parse_id, path, #path, #persisted?, prefix, prefix=, #resource_pluralized, #resource_uri, #respond_to?, #to_param, #to_partial_path

Methods included from Paginate

#collect, #paginate, #per_page

Methods included from Dirty

#changed, #changed?, #changed_attributes, #changes, #dirty_attributes, #previous_changes

Constructor Details

This class inherits a constructor from SparkApi::Models::Account

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class SparkApi::Models::Base

Class Method Details

.report(account_id, arguments = {}) ⇒ Object



4
5
6
# File 'lib/spark_api/models/account_report.rb', line 4

def self.report(, arguments={})
  collect(connection.get("/accounts/#{}/report", arguments)).first
end

Instance Method Details

#DisplayNameObject



8
9
10
# File 'lib/spark_api/models/account_report.rb', line 8

def DisplayName
  self.Name
end

#logoObject



24
25
26
27
28
# File 'lib/spark_api/models/account_report.rb', line 24

def 
  if images.kind_of? Array
    images.find { |image| image.Type == "Logo" }
  end
end

#primary_emailObject



12
13
14
15
16
# File 'lib/spark_api/models/account_report.rb', line 12

def primary_email
  if Array(emails).any? && emails.primary
    emails.primary.Address
  end
end

#primary_phoneObject



18
19
20
21
22
# File 'lib/spark_api/models/account_report.rb', line 18

def primary_phone
  if Array(phones).any? && phones.primary
    phones.primary.Number
  end
end