Module: Calendly::ModelUtils

Overview

Calendly model utility.

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



58
59
60
# File 'lib/calendly/models/model_utils.rb', line 58

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#clientCalendly::Client

Returns api client.

Returns:

Raises:

Since:

  • 0.1.0



22
23
24
25
26
# File 'lib/calendly/models/model_utils.rb', line 22

def client
  raise Error.new('@client is not ready.') if !@client || !@client.is_a?(Client)

  @client
end

#idString

alias of uuid.

Returns:

  • (String)

Raises:

Since:

  • 0.1.0



34
35
36
37
38
# File 'lib/calendly/models/model_utils.rb', line 34

def id
  raise Error.new('uuid is not defined.') unless defined? uuid

  uuid
end

#initialize(attrs = nil, client = nil) ⇒ Object

Parameters:

  • attrs (Hash) (defaults to: nil)

    the attributes of the model.

  • the (Calendly::Client)

    api client.



11
12
13
14
# File 'lib/calendly/models/model_utils.rb', line 11

def initialize(attrs = nil, client = nil)
  @client = client
  set_attributes attrs
end

#inspectObject



40
41
42
43
# File 'lib/calendly/models/model_utils.rb', line 40

def inspect
  description = "uuid:#{uuid}" if respond_to? :uuid
  "\#<#{self.class}:#{object_id} #{description}>"
end