Class: MoxiworksPlatform::Gallery
- Defined in:
- lib/moxiworks_platform/gallery.rb
Overview
Moxi Works Platform Gallery
Instance Attribute Summary collapse
-
#gallery_images ⇒ Array
Array of image Hashes in the format { thumb_url: [String] url to thumbail size image (smallest), small_url: [String] url to small size image (small), full_url: [String] url to full size image (medium), gallery_url: [String] url to gallery size image (large), raw_url: [String] url to raw image (largest) title: [String] human readable title of image is_main_listing_image: [Boolean] whether the image is the main image for the listing caption: [String] human readable caption for the image description: [String] human readable description of the image width: [Integer] width of the raw image height: [Integer] height of the raw image mime_type: [String] MIME or media type of the image.
-
#list_office_aor ⇒ String
MLS the listing is listed with.
-
#listing_id ⇒ String
The mls number associated with the listing.
-
#listing_images ⇒ Array
Array of image Hashes in the format { thumb_url: [String] url to thumbail size image (smallest), small_url: [String] url to small size image (small), full_url: [String] url to full size image (medium), gallery_url: [String] url to gallery size image (large), raw_url: [String] url to raw image (largest) title: [String] human readable title of image is_main_listing_image: [Boolean] whether the image is the main image for the listing caption: [String] human readable caption for the image description: [String] human readable description of the image width: [Integer] width of the raw image height: [Integer] height of the raw image mime_type: [String] MIME or media type of the image.
Attributes inherited from Resource
Class Method Summary collapse
-
.find(opts = {}) ⇒ Hash
Search For Galleries 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
#gallery_images ⇒ Array
Returns array of image Hashes in the format
thumb_url: [String] url to thumbail size image (smallest),
small_url: [String] url to small size image (small),
full_url: [String] url to full size image (medium),
gallery_url: [String] url to gallery size image (large),
raw_url: [String] url to raw image (largest)
title: [String] human readable title of image
is_main_listing_image: [Boolean] whether the image is the main image for the listing
caption: [String] human readable caption for the image
description: [String] human readable description of the image
width: [Integer] width of the raw image
height: [Integer] height of the raw image
mime_type: [String] MIME or media type of the image
.
34 35 36 |
# File 'lib/moxiworks_platform/gallery.rb', line 34 def gallery_images @gallery_images end |
#list_office_aor ⇒ String
Returns MLS the listing is listed with.
8 9 10 |
# File 'lib/moxiworks_platform/gallery.rb', line 8 def list_office_aor @list_office_aor end |
#listing_id ⇒ String
Returns the mls number associated with the listing.
13 14 15 |
# File 'lib/moxiworks_platform/gallery.rb', line 13 def listing_id @listing_id end |
#listing_images ⇒ Array
Returns array of image Hashes in the format
thumb_url: [String] url to thumbail size image (smallest),
small_url: [String] url to small size image (small),
full_url: [String] url to full size image (medium),
gallery_url: [String] url to gallery size image (large),
raw_url: [String] url to raw image (largest)
title: [String] human readable title of image
is_main_listing_image: [Boolean] whether the image is the main image for the listing
caption: [String] human readable caption for the image
description: [String] human readable description of the image
width: [Integer] width of the raw image
height: [Integer] height of the raw image
mime_type: [String] MIME or media type of the image
.
34 |
# File 'lib/moxiworks_platform/gallery.rb', line 34 attr_accessor :gallery_images |
Class Method Details
.find(opts = {}) ⇒ Hash
Search For Galleries in Moxi Works Platform
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/moxiworks_platform/gallery.rb', line 74 def self.find(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 agent_identifier = opts[:agent_uuid] unless(opts[:agent_uuid].nil? or opts[:agent_uuid].empty?) agent_identifier ||= opts[:moxi_works_agent_id] unless(opts[:moxi_works_agent_id].nil? or opts[:moxi_works_agent_id].empty?) raise ::MoxiworksPlatform::Exception::ArgumentError, "#agent_uuid or moxi_works_agent_id required" if agent_identifier.nil? url = "#{MoxiworksPlatform::Config.url}/api/galleries/#{agent_identifier}" results = MoxiResponseArray.new() json = {'galleries': []} 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['galleries'].each do |r| results << MoxiworksPlatform::Gallery.new(r) unless r.nil? or r.empty? end json['galleries'] = results end if block_given? yield(json['galleries']) end json end |