Sha256: db85294380d65d4593168675fad35de671c05d2222ccbe405c59c73122500eed

Contents?: true

Size: 1.27 KB

Versions: 10

Compression:

Stored size: 1.27 KB

Contents

require 'restful_model'
require 'tag'
require 'message'
require 'draft'
require 'contact'
require 'file'
require 'calendar'
require 'event'

# Rather than saying require 'thread', we need to explicitly force
# the thread model to load. Otherwise, we can't reference it below.
# Thread still refers to the built-in Thread type, and Inbox::Thread
# is undefined.
load "thread.rb"

module Inbox

  class Namespace < RestfulModel

    parameter :account_id
    parameter :name
    parameter :email_address
    parameter :provider

    def self.collection_name
      "n"
    end

    def threads
      @threads ||= RestfulModelCollection.new(Thread, @_api, @id)
    end

    def tags
      @tags ||= RestfulModelCollection.new(Tag, @_api, @id)
    end

    def messages
      @messages ||= RestfulModelCollection.new(Message, @_api, @id)
    end

    def files
      @files ||= RestfulModelCollection.new(File, @_api, @id)
    end

    def drafts
      @drafts ||= RestfulModelCollection.new(Draft, @_api, @id)
    end

    def contacts
      @contacts ||= RestfulModelCollection.new(Contact, @_api, @id)
    end

    def calendars
      @calendars ||= RestfulModelCollection.new(Calendar, @_api, @id)
    end

    def events
      @events ||= RestfulModelCollection.new(Event, @_api, @id)
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
inbox-0.14.1 lib/namespace.rb
inbox-0.14.0 lib/namespace.rb
inbox-0.13.0 lib/namespace.rb
inbox-0.12.0 lib/namespace.rb
inbox-0.11.0 lib/namespace.rb
inbox-0.10.1 lib/namespace.rb
inbox-0.10.0 lib/namespace.rb
inbox-0.9.0 lib/namespace.rb
inbox-0.8.1 lib/namespace.rb
inbox-0.8.0 lib/namespace.rb