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



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

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

Instance Method Details

#clientCalendly::Client

Returns api client.

Returns:

Raises:

Since:

  • 0.1.0



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

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



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

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.



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

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

#inspectObject



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

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