Module: ContextIO::API::Resource

Included in:
ContextIO::Account, ConnectToken, Contact, File, Message, OAuthProvider, Source, Thread, Webhook
Defined in:
lib/contextio/api/resource.rb

Overview

When included into a class, this module provides some helper methods for various things a singular resource will need or find useful.

Defined Under Namespace

Modules: DeclarativeClassSyntax

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_attributes{String => Numeric, String, Hash, Array, Boolean} (readonly)



60
61
62
# File 'lib/contextio/api/resource.rb', line 60

def api_attributes
  @api_attributes ||= fetch_attributes
end

#primary_keyString, Symbol (readonly)



67
68
69
# File 'lib/contextio/api/resource.rb', line 67

def primary_key
  self.class.primary_key
end

#resource_urlString (readonly)



45
46
47
# File 'lib/contextio/api/resource.rb', line 45

def resource_url
  @resource_url ||= api.url_for(self)
end

Instance Method Details

#deleteBoolean

Deletes the resource.



52
53
54
# File 'lib/contextio/api/resource.rb', line 52

def delete
  api.request(:delete, resource_url)['success']
end