activerecord_sqlserver_crm 4.2.3 → 4.2.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c580e7cf464d660090fd5ab8071968b5e3beda51
4
- data.tar.gz: df51138c6066be08d91f39737684806996729537
3
+ metadata.gz: 1a1aee0ccf6eaa2664c8787a3d37234fad3542c7
4
+ data.tar.gz: 5039b1cd46e1dec7077b686eef79c9f306de2b04
5
5
  SHA512:
6
- metadata.gz: fb166efbe90f6f0ab7ce587bce0602b019d99be9de2d9844260fe7a1e39c54257d3ffdc6896472e59ad091921d9ad51d511a77210775a7a8754cf2aaf03b6a48
7
- data.tar.gz: 4d3398b59a23fd4d76b6d0a040daa4a0f0b2da8ee29b538ad398d7099ee31c6b9728632febd8ebf4fe32f4b49a700cf009fdeb2e564d8cff8d354f28af54f7fb
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 referes to table differently than table name when using associations, you can use this method
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
 
@@ -1,3 +1,3 @@
1
1
  module ActiverecordSqlserverCrm
2
- VERSION = "4.2.3"
2
+ VERSION = "4.2.4"
3
3
  end
@@ -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
- body[field.downcase] = values[1]
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
@@ -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.3
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-07 00:00:00.000000000 Z
11
+ date: 2016-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails