activerecord_sqlserver_crm 4.2.3 → 4.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/active_record_extension.rb +12 -1
- data/lib/activerecord_sqlserver_crm/version.rb +1 -1
- data/lib/odata/create_operation.rb +2 -1
- data/lib/odata/operation.rb +5 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a1aee0ccf6eaa2664c8787a3d37234fad3542c7
|
4
|
+
data.tar.gz: 5039b1cd46e1dec7077b686eef79c9f306de2b04
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 315ee83ad3afe9386b2648066eb16d22d6e36204950d75e6d4b6210ad9294cbf2f672ba9d9b46461f80dcb6e610476f26c73f81be4061e966fa44a9511e36c55
|
7
|
+
data.tar.gz: 71ebb70cc16c4fd80fe95bd508fe48cebb8a200bbc21837f7380dcd7ff77133063bd3aca6c7276c21d6011c1b633dd9ceb1982cf87d0c37232cb5056f1ecf04a
|
@@ -74,7 +74,7 @@ module ActiveRecordExtension
|
|
74
74
|
associations.select { |a| a.macro == :belongs_to }
|
75
75
|
end
|
76
76
|
|
77
|
-
# If odata
|
77
|
+
# If odata refers to table differently than table name when using associations, you can use this method
|
78
78
|
def odata_table_reference
|
79
79
|
@odata_table_reference
|
80
80
|
end
|
@@ -82,6 +82,17 @@ module ActiveRecordExtension
|
|
82
82
|
def odata_table_reference=(value)
|
83
83
|
@odata_table_reference = value
|
84
84
|
end
|
85
|
+
|
86
|
+
# In some cases the odata field name is different than the database field name. This method is used for this mapping
|
87
|
+
def odata_field(field, options)
|
88
|
+
@odata_property_key ||= {}
|
89
|
+
@odata_property_key[field] = options[:crm_key]
|
90
|
+
end
|
91
|
+
|
92
|
+
def odata_field_value(crm_key)
|
93
|
+
@odata_property_key ||= {}
|
94
|
+
@odata_property_key[crm_key]
|
95
|
+
end
|
85
96
|
end
|
86
97
|
end
|
87
98
|
|
@@ -23,7 +23,8 @@ module OData
|
|
23
23
|
odata_table_ref = @ar.class.odata_table_reference || table_pluralize(belongs_to_field.table_name).downcase
|
24
24
|
body["#{belongs_to_field.options[:crm_key]}@odata.bind"] = "/#{odata_table_ref}(#{values[1]})"
|
25
25
|
else
|
26
|
-
|
26
|
+
key = @ar.class.odata_field_value(field.to_sym) || field.downcase
|
27
|
+
body[key] = values[1]
|
27
28
|
end
|
28
29
|
end
|
29
30
|
body.to_json
|
data/lib/odata/operation.rb
CHANGED
@@ -75,6 +75,11 @@ module OData
|
|
75
75
|
|
76
76
|
def send_odata
|
77
77
|
@ar.run_callbacks operation_callback_name do
|
78
|
+
if Rails.env.development?
|
79
|
+
Rails.logger.debug "SEND_ODATA URL: #{operation_url}"
|
80
|
+
Rails.logger.debug "SEND_ODATA METHOD: #{operation_method}"
|
81
|
+
Rails.logger.debug "SEND_ODATA BODY: #{operation_body}"
|
82
|
+
end
|
78
83
|
request = ::Typhoeus::Request.new(
|
79
84
|
operation_url,
|
80
85
|
method: operation_method,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord_sqlserver_crm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.
|
4
|
+
version: 4.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rolf Lawrenz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-07-
|
11
|
+
date: 2016-07-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|