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)


92
93
94
# File 'lib/user/crm/deals.rb', line 92

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)


73
74
75
# File 'lib/user/crm/deals.rb', line 73

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


35
36
37
# File 'lib/user/crm/deals.rb', line 35

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)


15
16
17
# File 'lib/user/crm/deals.rb', line 15

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


25
26
27
# File 'lib/user/crm/deals.rb', line 25

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)


56
57
58
# File 'lib/user/crm/deals.rb', line 56

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)


108
109
110
# File 'lib/user/crm/deals.rb', line 108

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