Module: Teamlab::CrmCommon

Included in:
Crm
Defined in:
lib/teamlab/modules/crm/crm_common.rb

Overview

Methods for working with crm common methods

Instance Method Summary collapse

Instance Method Details

#create_currency_rate(from = 'EUR', to = 'USD', rate = '1.0') ⇒ Object



26
27
28
# File 'lib/teamlab/modules/crm/crm_common.rb', line 26

def create_currency_rate(from = 'EUR', to = 'USD', rate = '1.0')
  @request.post(%w[currency rates], fromCurrency: from, toCurrency: to, rate: rate)
end

#delete_currency_rate_by_id(id) ⇒ Object



42
43
44
# File 'lib/teamlab/modules/crm/crm_common.rb', line 42

def delete_currency_rate_by_id(id)
  @request.delete(['currency', 'rates', id.to_s], {})
end

#get_all_currency_ratesObject



22
23
24
# File 'lib/teamlab/modules/crm/crm_common.rb', line 22

def get_all_currency_rates
  @request.get(%w[currency rates], {})
end

#get_currency_listObject



6
7
8
# File 'lib/teamlab/modules/crm/crm_common.rb', line 6

def get_currency_list
  @request.get(%w[settings currency])
end

#get_currency_rate_by_currency(from_currency, to_currency) ⇒ Hash

Get currency rate by currencies

Parameters:

  • from_currency (String)

    rate from currency

  • to_currency (String)

    rate to currency

Returns:

  • (Hash)

    currency rate data



38
39
40
# File 'lib/teamlab/modules/crm/crm_common.rb', line 38

def get_currency_rate_by_currency(from_currency, to_currency)
  @request.get(['currency', 'rates', from_currency.to_s, to_currency.to_s])
end

#get_currency_rate_by_id(id) ⇒ Object



30
31
32
# File 'lib/teamlab/modules/crm/crm_common.rb', line 30

def get_currency_rate_by_id(id)
  @request.get(['currency', 'rates', id.to_s], {})
end

#get_result_of_convertation(options = {}) ⇒ Object



10
11
12
# File 'lib/teamlab/modules/crm/crm_common.rb', line 10

def get_result_of_convertation(options = {})
  @request.get(%w[settings currency convert], options)
end

#get_summary_table(currency) ⇒ Object



14
15
16
# File 'lib/teamlab/modules/crm/crm_common.rb', line 14

def get_summary_table(currency)
  @request.get(%w[settings currency summarytable], currency: currency)
end

#set_is_portal_configured(options = {}) ⇒ Object



46
47
48
# File 'lib/teamlab/modules/crm/crm_common.rb', line 46

def set_is_portal_configured(options = {})
  @request.put(%w[settings], options)
end

#update_crm_currency(currency) ⇒ Object



18
19
20
# File 'lib/teamlab/modules/crm/crm_common.rb', line 18

def update_crm_currency(currency)
  @request.put(%w[settings currency], currency: currency)
end

#update_currency_rate(id, from, to, rate) ⇒ Hash

Update currency rate object

Parameters:

  • id (String)

    id of rate currency

  • from (String)

    rate from currency

  • to (String)

    rate to currency

  • rate (String)

    currency rate

Returns:

  • (Hash)

    currency and rate data



56
57
58
# File 'lib/teamlab/modules/crm/crm_common.rb', line 56

def update_currency_rate(id, from, to, rate)
  @request.put(['currency', 'rates', id.to_s], fromCurrency: from, toCurrency: to, rate: rate)
end