PipedrivePUT 1.1.35 → 1.1.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/PipedrivePUT/currencies.rb +13 -22
- data/lib/PipedrivePUT/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31cc87dc6a10b4576921abbebe6b1205b6fd3ba5
|
4
|
+
data.tar.gz: 0d3912db82bc8af846a50a81cea969f9238f9f78
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c18660ed24ce76649827ec7f9387fee431130877b234e0b2c312f5572055c49368500d7e4b48d8d92d6cbe86e9b36a3664a9fdd1b633f4db00e1a4a5984b9a0
|
7
|
+
data.tar.gz: b806227339628fb3dcd57390637024f334829ff6e79dc6d539edae8fc126ffaa8b1e6041fdcb4b4c5ab16147a2fa3128ecd7ab06d5eabf50b265f135e2148fc6
|
@@ -2,17 +2,26 @@ module PipedrivePUT
|
|
2
2
|
class Currencies
|
3
3
|
include PipedrivePUT
|
4
4
|
|
5
|
+
|
6
|
+
def self.getExchangeRate(currency_name, options = {})
|
7
|
+
get_curr = PipedrivePUT::Currencies.getCurr(currency_name)
|
8
|
+
get_code = get_curr['data'][0]['code']
|
9
|
+
Money::Bank::GoogleCurrency.ttl_in_seconds = 86400
|
10
|
+
Money.default_bank = Money::Bank::GoogleCurrency.new
|
11
|
+
get_amount = options[:amount].to_i
|
12
|
+
set_new_exchange = options[:ex_code].parameterize.to_sym
|
13
|
+
set_amount_and_code_to_exchange = Money.new(get_amount, get_code)
|
14
|
+
exchange_rate = set_amount_and_code_to_exchange
|
15
|
+
formated_rate = exchange_rate.exchange_to(set_new_exchange).format
|
16
|
+
end
|
5
17
|
|
6
|
-
#---------------------------------------------------------get all currencies----------------------------------------------------------------------------------------------------------------------
|
7
18
|
def self.getAllCurr
|
8
19
|
@base = 'https://api.pipedrive.com/v1/currencies?api_token=' + @@key.to_s
|
9
20
|
@content = open(@base.to_s).read
|
10
21
|
@parsed = JSON.parse(@content)
|
11
22
|
return @parsed
|
12
23
|
end
|
13
|
-
#---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
14
24
|
|
15
|
-
#----------------------------------------- search for currencies -----------------------------------------------------------------------------------------------------------------------------------
|
16
25
|
def self.getCurr(currency_name)
|
17
26
|
curr_string = currency_name.to_s
|
18
27
|
curr_string_count = curr_string.split.size
|
@@ -62,26 +71,8 @@ module PipedrivePUT
|
|
62
71
|
@parsed = JSON.parse(@content)
|
63
72
|
return @parsed
|
64
73
|
end
|
65
|
-
end
|
66
|
-
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
74
|
+
end
|
67
75
|
end
|
68
|
-
|
69
|
-
#----------------------------------------------------------------------------------------Currency Calculator------------------------------------------------------------------------------------
|
70
|
-
|
71
|
-
def self.getExchangeRate(currency_name, options = {})
|
72
|
-
get_curr = PipedrivePUT::Currencies.getCurr(currency_name)
|
73
|
-
get_code = get_curr['data'][0]['code']
|
74
|
-
Money::Bank::GoogleCurrency.ttl_in_seconds = 86400
|
75
|
-
Money.default_bank = Money::Bank::GoogleCurrency.new
|
76
|
-
get_amount = options[:amount].to_i
|
77
|
-
set_new_exchange = options[:ex_code].parameterize.to_sym
|
78
|
-
set_amount_and_code_to_exchange = Money.new(get_amount, get_code)
|
79
|
-
exchange_rate = set_amount_and_code_to_exchange
|
80
|
-
formated_rate = exchange_rate.exchange_to(set_new_exchange).format
|
81
|
-
return formated_rate
|
82
|
-
end
|
83
|
-
#----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
84
|
-
|
85
76
|
end
|
86
77
|
|
87
78
|
|
data/lib/PipedrivePUT/version.rb
CHANGED