civicrm 1.2.2 → 1.2.5
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4a770859b71bcf18bfff90a976e2dbbec6aa9af3
|
4
|
+
data.tar.gz: c884fdf962c79286c4bfd40dc3a606cbcbea06b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3ad4d02efbc556f3e8eb8bcad2709b1771ea838d596c98c0d5ccabc16647977e73d2219fd5805b879c55ce6bad9c87eeb4853d779618bcaed28b435898261bd9
|
7
|
+
data.tar.gz: 28bd41a3ef1fa67487e6a46e86bed8604d730d157141c578f7457d5dff805477cecba12fcd604495358f629a469146b666d30e9701f38a6a81c105d32fe7ff40
|
data/lib/civicrm/actions/list.rb
CHANGED
@@ -131,6 +131,9 @@ module CiviCrm
|
|
131
131
|
class Note < BaseResource
|
132
132
|
entity :note
|
133
133
|
end
|
134
|
+
class OptionGroup < BaseResource
|
135
|
+
entity :option_group
|
136
|
+
end
|
134
137
|
class Phone < BaseResource
|
135
138
|
entity :phone
|
136
139
|
end
|
@@ -153,3 +156,6 @@ module CiviCrm
|
|
153
156
|
entity :survey_respondant
|
154
157
|
end
|
155
158
|
end
|
159
|
+
|
160
|
+
require "civicrm/resources/financial_type"
|
161
|
+
require "civicrm/resources/option_value"
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module CiviCrm
|
2
|
+
class FinancialType < BaseResource
|
3
|
+
entity :financial_type
|
4
|
+
|
5
|
+
@@_financial_type_cache = {}
|
6
|
+
|
7
|
+
def self.get(name, cache: true, create: Rails.env.development?)
|
8
|
+
cache_key = name
|
9
|
+
|
10
|
+
if cache && @@_financial_type_cache.key?(cache_key)
|
11
|
+
return @@_financial_type_cache[cache_key]
|
12
|
+
end
|
13
|
+
|
14
|
+
type = find_by("name" => name)
|
15
|
+
type ||= create(name: name) if create
|
16
|
+
|
17
|
+
if type
|
18
|
+
@@_financial_type_cache[cache_key] = type.id if cache
|
19
|
+
return type.id
|
20
|
+
end
|
21
|
+
|
22
|
+
raise Errors::NotFound.new(
|
23
|
+
"FinancialType with name=#{name}"
|
24
|
+
)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module CiviCrm
|
2
|
+
class OptionValue < BaseResource
|
3
|
+
entity :option_value
|
4
|
+
|
5
|
+
@@_option_value_cache = {}
|
6
|
+
|
7
|
+
def self.get(group, name, cache: true, create: Rails.env.development?)
|
8
|
+
cache_key = [group, name]
|
9
|
+
|
10
|
+
if cache && @@_option_value_cache.key?(cache_key)
|
11
|
+
return @@_option_value_cache[cache_key]
|
12
|
+
end
|
13
|
+
|
14
|
+
option = find_by(
|
15
|
+
'name' => name,
|
16
|
+
'option_group_id.title' => group
|
17
|
+
)
|
18
|
+
|
19
|
+
if !option && create
|
20
|
+
group = OptionGroup.find_by!(title: group)
|
21
|
+
option = create(option_group_id: group.id, name: name)
|
22
|
+
end
|
23
|
+
|
24
|
+
if option
|
25
|
+
@@_option_value_cache[cache_key] = option.value if cache
|
26
|
+
return option.value
|
27
|
+
end
|
28
|
+
|
29
|
+
raise Errors::NotFound.new(
|
30
|
+
"#{group} with name=#{name}"
|
31
|
+
)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
data/lib/civicrm/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: civicrm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Iskander Haziev
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|
@@ -139,6 +139,8 @@ files:
|
|
139
139
|
- lib/civicrm/profiling.rb
|
140
140
|
- lib/civicrm/resource.rb
|
141
141
|
- lib/civicrm/resources/base.rb
|
142
|
+
- lib/civicrm/resources/financial_type.rb
|
143
|
+
- lib/civicrm/resources/option_value.rb
|
142
144
|
- lib/civicrm/version.rb
|
143
145
|
- spec/requests/base_spec.rb
|
144
146
|
- spec/resources/contact_spec.rb
|