Sha256: 277d309210f44fb31e9a942a446812b0e57665dd0888b76389c6bd6d907c62dc

Contents?: true

Size: 770 Bytes

Versions: 1

Compression:

Stored size: 770 Bytes

Contents

class MLS::Brokerage < MLS::Resource

  attr_accessor :avatar

  attribute :id,       Fixnum,  :serialize => :if_present
  attribute :name,     String,  :serialize => :if_present
  attribute :admin_id, Fixnum,  :serialize => :if_present
  attribute :slug,     String,  :serialize => false
  attribute :palette,  Hash,    :serialize => :if_present

  class << self

    def find(id)
      response = MLS.get("/brokerages/#{id}")
      MLS::Brokerage::Parser.parse(response.body)
    end

    def all(options={})
      response = MLS.get('/brokerages', options)
      MLS::Brokerage::Parser.parse_collection(response.body)
    end

  end

end

class MLS::Brokerage::Parser < MLS::Parser
  def avatar=(avatar)
    @object.avatar = MLS::Photo::Parser.build(avatar)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mls-0.14.0 lib/mls/models/brokerage.rb