Class: MoxiworksPlatform::PresentationLog

Inherits:
Resource
  • Object
show all
Defined in:
lib/moxiworks_platform/presentation_log.rb

Overview

Moxi Works Platform PresentationLog

Instance Attribute Summary collapse

Attributes inherited from Resource

#headers

Class Method Summary collapse

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

#agent_fnamestring

Returns First name of agent. This can be null if there is no data for this attribute.

Returns:

  • (string)

    First name of agent. This can be null if there is no data for this attribute.



15
16
17
# File 'lib/moxiworks_platform/presentation_log.rb', line 15

def agent_fname
  @agent_fname
end

#agent_lnamestring

Returns Last name of agent. This can be null if there is no data for this attribute.

Returns:

  • (string)

    Last name of agent. This can be null if there is no data for this attribute.



22
23
24
# File 'lib/moxiworks_platform/presentation_log.rb', line 22

def agent_lname
  @agent_lname
end

#agent_office_idstring

Returns This is the ID of the office for the Agent associated with the presentation. This will be an integer.

Returns:

  • (string)

    This is the ID of the office for the Agent associated with the presentation. This will be an integer.



50
51
52
# File 'lib/moxiworks_platform/presentation_log.rb', line 50

def agent_office_id
  @agent_office_id
end

#agent_uuidstring

Returns This is the Moxi Works Platform ID of the presentation_log which an ActionLog entry is associated with. This will be an RFC 4122 compliant UUID.

Returns:

  • (string)

    This is the Moxi Works Platform ID of the presentation_log which an ActionLog entry is associated with. This will be an RFC 4122 compliant UUID.



9
10
11
# File 'lib/moxiworks_platform/presentation_log.rb', line 9

def agent_uuid
  @agent_uuid
end

#createdstring

Returns This is the Unix timestamp for the creation time of the presentation.

Returns:

  • (string)

    This is the Unix timestamp for the creation time of the presentation.



36
37
38
# File 'lib/moxiworks_platform/presentation_log.rb', line 36

def created
  @created
end

#editedstring

Returns This is the Unix timestamp for the last time the presentation was edited.

Returns:

  • (string)

    This is the Unix timestamp for the last time the presentation was edited.



43
44
45
# File 'lib/moxiworks_platform/presentation_log.rb', line 43

def edited
  @edited
end

#external_identifierstring

Returns This is the ID of the Agent utilized by their company.

Returns:

  • (string)

    This is the ID of the Agent utilized by their company.



85
86
87
# File 'lib/moxiworks_platform/presentation_log.rb', line 85

def external_identifier
  @external_identifier
end

#external_office_idstring

Returns This is the ID of the office for this Agent utilized by their company.

Returns:

  • (string)

    This is the ID of the office for this Agent utilized by their company.



92
93
94
# File 'lib/moxiworks_platform/presentation_log.rb', line 92

def external_office_id
  @external_office_id
end

#moxi_works_presentation_idstring

Returns The unique UUID of the presentation. This will be an RFC 4122 compliant UUID.

Returns:

  • (string)

    The unique UUID of the presentation. This will be an RFC 4122 compliant UUID.



99
100
101
# File 'lib/moxiworks_platform/presentation_log.rb', line 99

def moxi_works_presentation_id
  @moxi_works_presentation_id
end

#pdf_requestedstring

Returns The number of PDF documents requested.

Returns:

  • (string)

    The number of PDF documents requested.



71
72
73
# File 'lib/moxiworks_platform/presentation_log.rb', line 71

def pdf_requested
  @pdf_requested
end

#pres_requestedstring

Returns The number of Online presentations requested.

Returns:

  • (string)

    The number of Online presentations requested.



78
79
80
# File 'lib/moxiworks_platform/presentation_log.rb', line 78

def pres_requested
  @pres_requested
end

#sent_by_agentstring

Returns The UUID of the agent that sent the presentation to the client. This will be an RFC 4122 compliant UUID.

Returns:

  • (string)

    The UUID of the agent that sent the presentation to the client. This will be an RFC 4122 compliant UUID.



64
65
66
# File 'lib/moxiworks_platform/presentation_log.rb', line 64

def sent_by_agent
  @sent_by_agent
end

#titlestring

Returns The title of the presentation. This can be null if there is no data for this attribute.

Returns:

  • (string)

    The title of the presentation. This can be null if there is no data for this attribute.



29
30
31
# File 'lib/moxiworks_platform/presentation_log.rb', line 29

def title
  @title
end

#typestring

Returns Whether the presentation is for a buyer or seller.

Returns:

  • (string)

    Whether the presentation is for a buyer or seller.



57
58
59
# File 'lib/moxiworks_platform/presentation_log.rb', line 57

def type
  @type
end

Class Method Details

.search(opts = {}) ⇒ Hash

Search For Agents in Moxi Works Platform

Examples:

results = MoxiworksPlatform::PresentationLog.search(
moxi_works_company_id: 'the_company',
updated_after:  Time.now.to_i - 1296000,
)

Parameters:

  • opts (Hash) (defaults to: {})

    named parameter Hash

Options Hash (opts):

  • :moxi_works_company_id (String)

    REQUIRED The Moxi Works Company ID For the search (use Company.search to determine available moxi_works_company_id)

    optional Search parameters

  • :updated_after (Integer)

    Unix timestamp representing the start time for the search. If no updated_after parameter is included in the request, only presentations updated in the last seven days will be included in the response.

  • :updated_before (Integer)

    Unix timestamp representing the end time for the search. If no updated_before parameter is included in the request, only presentations updated in the seven days following updated_after will be included in the response.

  • :created_after (Integer)

    Unix timestamp representing the start time for the search.

  • :created_after (Integer)

    Unix timestamp representing the end time for the search. If no created_before parameter is included in the request, only presentations updated in the seven days following created_after will be included in the response.

Returns:

  • (Hash)

    with the format:

    presentations:  [Array] containing MoxiworkPlatform::PresentationLog objects
    

Raises:

  • ::MoxiworksPlatform::Exception::ArgumentError if required named parameters aren't included



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/moxiworks_platform/presentation_log.rb', line 130

def self.search(opts={})
  url ||= "#{MoxiworksPlatform::Config.url}/api/presentation_logs"
  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


  results = MoxiResponseArray.new()
  json = { 'presentations':[]}
  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)

    results.page_number = json['page_number'] if(json.is_a?(Hash) && json['page_number'])
    results.total_pages = json['total_pages'] if(json.is_a?(Hash) && json['total_pages'])

    json['presentations'].each do |r|
      results << MoxiworksPlatform::PresentationLog.new(r) unless r.nil? or r.empty?
    end
    json['presentations'] = results
  end
  json
end