Class: StarRezReport

Inherits:
Object show all
Includes:
HTTParty
Defined in:
lib/starrez_api/star_rez_report.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/starrez_api/star_rez_report.rb', line 7

def name
  @name
end

#resultsObject

Returns the value of attribute results.



7
8
9
# File 'lib/starrez_api/star_rez_report.rb', line 7

def results
  @results
end

Class Method Details

.find_by_id(entry, options = {}) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/starrez_api/star_rez_report.rb', line 9

def self.find_by_id(entry, options = {})
  if entry.blank?
    raise IOError, "Must include a report ID to search"
  end
  conditions = options[:conditions].blank? ? '' : "?#{self.get_condition_string(options[:conditions])}"
  url = "#{base_uri}/getreportbyid/#{entry}.xml/#{conditions}"
  response = get(url)
  if options[:return].eql? :response
    return response
  else
    return self.parse_response(response)
  end
end

.find_by_name(name, options = {}) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/starrez_api/star_rez_report.rb', line 23

def self.find_by_name(name, options = {})
  if name.blank?
    raise IOError, "Must include a report name"
  end
  conditions = options[:conditions].blank? ? '' : "?#{self.get_condition_string(options[:conditions])}"
  url = "#{base_uri}/getreportbyname/#{URI::escape(name.to_s)}.xml/#{conditions}"
  response = get(url)
  if options[:return].eql? :response
    return response
  else
    return self.parse_response(response)
  end
end