Class: WhenHub::Schedule

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model
Defined in:
lib/whenhub/schedule.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#calendarObject

Returns the value of attribute calendar.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def calendar
  @calendar
end

#clientObject

Returns the value of attribute client.



10
11
12
# File 'lib/whenhub/schedule.rb', line 10

def client
  @client
end

#createdAtObject

Returns the value of attribute createdAt.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def createdAt
  @createdAt
end

#createdByObject

Returns the value of attribute createdBy.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def createdBy
  @createdBy
end

#curatorObject

Returns the value of attribute curator.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def curator
  @curator
end

#descriptionObject

Returns the value of attribute description.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def description
  @description
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def name
  @name
end

#scopeObject

Returns the value of attribute scope.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def scope
  @scope
end

#tagsObject

Returns the value of attribute tags.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def tags
  @tags
end

#updatedAtObject

Returns the value of attribute updatedAt.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def updatedAt
  @updatedAt
end

#updatedByObject

Returns the value of attribute updatedBy.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def updatedBy
  @updatedBy
end

#userIdObject

Returns the value of attribute userId.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def userId
  @userId
end

#viewCodeObject

Returns the value of attribute viewCode.



7
8
9
# File 'lib/whenhub/schedule.rb', line 7

def viewCode
  @viewCode
end

Class Method Details

.build(client, attributes) ⇒ Object



12
13
14
15
16
# File 'lib/whenhub/schedule.rb', line 12

def self.build(client, attributes)
  new(attributes).tap do |schedule|
    schedule.client = client
  end
end

Instance Method Details

#deleteObject



35
36
37
# File 'lib/whenhub/schedule.rb', line 35

def delete
  @client.delete("/api/schedules/#{id}")
end

#eventsObject



39
40
41
# File 'lib/whenhub/schedule.rb', line 39

def events
  EventsCollection.new(client, self)
end

#saveObject



18
19
20
21
22
23
24
25
# File 'lib/whenhub/schedule.rb', line 18

def save
  assign_attributes(
    @client.post(
      '/api/users/me/schedules',
      writeable_attributes
    )
  )
end

#writeable_attributesObject



27
28
29
30
31
32
33
# File 'lib/whenhub/schedule.rb', line 27

def writeable_attributes
  {
    name: name,
    description: description,
    scope: scope
  }
end