Class: ZendeskAPI::Attachment

Inherits:
Data
  • Object
show all
Defined in:
lib/zendesk_api/resources/misc.rb

Instance Attribute Summary

Attributes inherited from Data

#association, #attributes

Instance Method Summary collapse

Methods inherited from Data

#==, #id, #method_missing, #new_record?, only_send_unnested_params, #path, resource_name, singular_resource_name, #to_s, unnested_params

Methods included from Associations

#wrap_resource

Constructor Details

#initialize(client, attributes) ⇒ Attachment

Returns a new instance of Attachment.



28
29
30
31
32
33
34
# File 'lib/zendesk_api/resources/misc.rb', line 28

def initialize(client, attributes)
  if attributes.is_a?(Hash)
    super
  else
    super(client, :file => attributes)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ZendeskAPI::Data

Instance Method Details

#saveObject



36
37
38
39
# File 'lib/zendesk_api/resources/misc.rb', line 36

def save
  upload = Upload.create!(client, :file => file)
  self.token = upload.token
end

#to_paramObject



41
42
43
# File 'lib/zendesk_api/resources/misc.rb', line 41

def to_param
  token
end