Module: Deals

Included in:
CRM
Defined in:
lib/user/crm/deals.rb

Instance Method Summary collapse

Instance Method Details

#create_deal(data, options = nil) ⇒ Object

Create deal.

Create a deal with data.

Parameters

data

(Hash) – Data to be submitted.

Example

data = {
  dealData: {
    title: 'New deal',
    stepId: 1,
    value: 10500
  }
}
@data = @mints_user.create_deal(data.to_json)


94
95
96
# File 'lib/user/crm/deals.rb', line 94

def create_deal(data, options = nil)
  @client.raw('post', '/crm/deals', options, data)
end

#get_deal(id, options = nil) ⇒ Object

Get deal.

Get a deal info.

Parameters

id

(Integer) – Deal id.

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

First Example

@data = @mints_user.get_deal(1)

Second Example

options = { fields: 'id, title' }
@data = @mints_user.get_deal(1, options)


75
76
77
# File 'lib/user/crm/deals.rb', line 75

def get_deal(id, options = nil)
  @client.raw('get', "/crm/deals/#{id}", options)
end

#get_deal_currenciesObject

Get deal currencies.

Get currencies of deals.

Example

@data = @mints_user.get_deal_currencies


37
38
39
# File 'lib/user/crm/deals.rb', line 37

def get_deal_currencies
  @client.raw('get', '/crm/deal/currencies')
end

#get_deal_permits(id) ⇒ Object

Get deal permits.

Get permits of a deal.

Parameters

id

(Integer) – Deal id.

Example

@data = @mints_user.get_deal_permits(7)


17
18
19
# File 'lib/user/crm/deals.rb', line 17

def get_deal_permits(id)
  @client.raw('get', "/crm/deals/#{id}/permits")
end

#get_deal_support_dataObject

Get deal support data.

Get support data of deals.

Example

@data = @mints_user.get_deal_support_data


27
28
29
# File 'lib/user/crm/deals.rb', line 27

def get_deal_support_data
  @client.raw('get', '/crm/deals/support-data')
end

#get_deals(options = nil, use_post = true) ⇒ Object

Get deals.

Get a collection of deals.

Parameters

options

(Hash) – List of Resource Collection Options shown above can be used as parameter.

use_post

(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.

First Example

@data = @mints_user.get_deals

Second Example

options = { fields: 'id, title' }
@data = @mints_user.get_deals(options)

Third Example

options = { fields: 'id, title' }
@data = @mints_user.get_deals(options, false)


58
59
60
# File 'lib/user/crm/deals.rb', line 58

def get_deals(options = nil, use_post = true)
  get_query_results('/crm/deals', options, use_post)
end

#update_deal(id, data, options = nil) ⇒ Object

Update deal.

Update a deal data.

Parameters

id

(Integer) – Deal id.

data

(Hash) – Data to be submitted.

Example

data = {
  title: 'New Deal Modified'
}
@data = @mints_user.update_deal(102, data.to_json)


110
111
112
# File 'lib/user/crm/deals.rb', line 110

def update_deal(id, data, options = nil)
  @client.raw('put', "/crm/deals/#{id}", options, data)
end