Class: Sellsy::Attachment

Inherits:
Object
  • Object
show all
Defined in:
lib/sellsy/attachment.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#entity_idObject

Returns the value of attribute entity_id.



3
4
5
# File 'lib/sellsy/attachment.rb', line 3

def entity_id
  @entity_id
end

#entity_typeObject

Returns the value of attribute entity_type.



3
4
5
# File 'lib/sellsy/attachment.rb', line 3

def entity_type
  @entity_type
end

#fileObject

Returns the value of attribute file.



3
4
5
# File 'lib/sellsy/attachment.rb', line 3

def file
  @file
end

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/sellsy/attachment.rb', line 3

def id
  @id
end

Instance Method Details

#createObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sellsy/attachment.rb', line 5

def create
  command = {
      'method' => 'Briefcases.uploadFile',
      'params' => {
          'linkedtype' => @entity_type,
          'linkedid' => @entity_id
      }
  }

  response = MultiJson.load(Sellsy::Api.request(command, file))
  @id = response['response']
  response['status'] == 'success'
end