Class: Calendlyr::Object
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Calendlyr::Object
show all
- Defined in:
- lib/calendlyr/object.rb
Direct Known Subclasses
ActivityLog, Availabilities::Rule, Availabilities::UserBusyTime, Availabilities::UserSchedule, Event, EventType, EventTypes::AvailableTime, EventTypes::Membership, EventTypes::Profile, Events::Cancellation, Events::Guest, Events::Invitee, Events::InviteeNoShow, Group, Groups::Relationship, Organization, Calendlyr::Organizations::Invitation, Calendlyr::Organizations::Membership, RoutingForm, RoutingForms::Submission, SchedulingLink, Share, User, Webhooks::InviteePayload, Webhooks::Payload, Webhooks::Subscription
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(attributes) ⇒ Object
Returns a new instance of Object.
9
10
11
|
# File 'lib/calendlyr/object.rb', line 9
def initialize(attributes)
super(to_ostruct(attributes.merge(uuid: (attributes))))
end
|
Class Method Details
.get_slug(path) ⇒ Object
5
6
7
|
# File 'lib/calendlyr/object.rb', line 5
def self.get_slug(path)
path.split("/").last
end
|
Instance Method Details
23
24
25
|
# File 'lib/calendlyr/object.rb', line 23
def (attrs)
attrs["uri"] ? get_slug(attrs["uri"]) : nil
end
|
#to_ostruct(obj) ⇒ Object
13
14
15
16
17
18
19
20
21
|
# File 'lib/calendlyr/object.rb', line 13
def to_ostruct(obj)
if obj.is_a?(Hash)
OpenStruct.new(obj.map { |key, val| [key, to_ostruct(val)] }.to_h)
elsif obj.is_a?(Array)
obj.map { |o| to_ostruct(o) }
else obj
end
end
|