gotransverse-tract-api 0.20.2 → 0.20.3

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: 5c91ea0793c86a852f94944cd0d2ba0c2f43922d
4
- data.tar.gz: 4167f32e281efb0dbd18d44b7689bebfb5fb7d94
3
+ metadata.gz: 49320d13e8447d044fb4ace43f31c516e8122545
4
+ data.tar.gz: b57e6c0569e216a1b39adaf0ca59132bd11d40d9
5
5
  SHA512:
6
- metadata.gz: 97e3406e72541e8d876220e930c27aea7e4d881d4ce610aef84c1200cb99094c4afd5f865e4c99f182040095a28942a9b5513ffde37fb3b3085f676557a75721
7
- data.tar.gz: 78e8cc8e3e496bf547f9557138b4abdeb0d85bc9d5475cec1c17f84a09b91201ed48df5cdd8613cdcb1b64e497d7d925ad3946a05784e5e57e70690b1c1e78c5
6
+ metadata.gz: ee969b37aff87f2fa6e50d105056509bfc9e75e42f473d36ee1bbeff93becff365cbe8bc660d455742e759f9443b267dd943540a0897ed6d8190ea046ff5b374
7
+ data.tar.gz: c7bfd8ad6f868394c77f4aac7f7bb3eaef1abb6522f205da6da31da6daf155313bb9e425f8423a4607a214689e147a0f874e213e64bb92451728903db086f777
@@ -56,7 +56,7 @@ module GoTransverseTractApi
56
56
  orderDate: sales_order[:order_date],
57
57
  orderStatus: sales_order[:order_status]
58
58
  },
59
- customFieldValues: BillingAccount::CustomFieldValue.get_custom_field_values(sales_order[:custom_field_values]),
59
+ customFieldValues: BillingAccount::CustomFieldValue.get_custom_field_values(sales_order[:custom_field_values]),
60
60
  orderItems: {
61
61
  attributes: {},
62
62
  orderItem: get_order_items(sales_order[:order_items][:order_item])
@@ -95,15 +95,33 @@ module GoTransverseTractApi
95
95
  # @param {Hash} obj (Order or Service or Billing Account)
96
96
  #
97
97
  def get_custom_field_values(obj={})
98
- custom_field_values = {
99
- attributes: {},
100
- customFieldValue: {
101
- attributes: {value: obj[:custom_field_value][:value]},
102
- customField: {eid: obj[:custom_field_value][:custom_field][:eid]}
98
+ return obj if obj.empty?
99
+
100
+ if obj[:custom_field_value].is_a?(Hash)
101
+ return { attributes: {}, customFieldValue: get_custom_field_value(obj[:custom_field_value]) }
102
+ end
103
+
104
+ custom_fields_struct = { attributes: {}, customFieldValue: [] }
105
+
106
+ obj[:custom_field_value].each do|item|
107
+ custom_fields_struct[:customFieldValue] << {
108
+ customFieldValue: get_custom_field_value(item)
109
+ }
110
+ end
111
+
112
+ custom_fields_struct
113
+ end
114
+
115
+ #
116
+ # @param {Hash} field (custom_field_value)
117
+ #
118
+ def get_custom_field_value(field)
119
+ custom_field_value = {
120
+ attributes: {value: field[:value]},
121
+ customField: {eid: field[:custom_field][:eid]}
103
122
  }
104
- }
105
123
 
106
- custom_field_values
124
+ custom_field_value
107
125
  end
108
126
  end
109
127
 
@@ -119,7 +119,7 @@ module GoTransverseTractApi
119
119
  # @param {Long} eid
120
120
  # @param {Hash} sales_order
121
121
  #
122
- def add_custom_field_value(eid, sales_order)
122
+ def add_custom_field_value(eid, sales_order, custom_field_eid=nil)
123
123
  data =
124
124
  {
125
125
  addCustomFieldValue: {},
@@ -127,6 +127,8 @@ module GoTransverseTractApi
127
127
  customFieldValue: { value: sales_order[:value] }
128
128
  }
129
129
 
130
+ data[:customField] = { eid: custom_field_eid } if custom_field_eid
131
+
130
132
  xml_data = GoTransverseTractApi.generateXML(data,'addCustomFieldValue')
131
133
  GoTransverseTractApi.post_request_for(self, {eid: eid}, xml_data, "addCustomFieldValue")
132
134
  end
@@ -1,6 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.20.2"
3
+ VERSION = "0.20.3"
4
4
  TARGET_API_VERSION = "1.29"
5
5
 
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gotransverse-tract-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.20.2
4
+ version: 0.20.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien DeFrance
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-10-20 00:00:00.000000000 Z
13
+ date: 2016-12-08 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler