Class: ZendeskAPI::Attachment

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

Instance Attribute Summary

Attributes inherited from Data

#association, #attributes, #errors, #response

Instance Method Summary collapse

Methods inherited from Data

#==, #id, inherited, #loaded_associations, #method_missing, namespace, new_from_response, #new_record?, #path, resource_name, resource_path, singular_resource_name, subclasses, #to_json, #to_s

Methods included from Associations

included, #wrap_resource

Constructor Details

#initialize(client, attributes) ⇒ Attachment

Returns a new instance of Attachment.



80
81
82
83
84
# File 'lib/zendesk_api/resources.rb', line 80

def initialize(client, attributes)
  attributes[:file] ||= attributes.delete(:id)

  super
end

Dynamic Method Handling

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

Instance Method Details

#saveObject



86
87
88
89
# File 'lib/zendesk_api/resources.rb', line 86

def save
  upload = Upload.create!(@client, attributes)
  self.token = upload.token
end

#to_paramObject



91
92
93
# File 'lib/zendesk_api/resources.rb', line 91

def to_param
  token
end