gotransverse-tract-api 0.2.3 → 0.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: 7069d33e78b10067c41980c6ae090a5d5246cffa
4
- data.tar.gz: 3e5aed2f1cdf1e842da35b4c3a1cd52bcbbbf0ed
3
+ metadata.gz: e933cacd16367a1f49125bc4a3832c1c9d7e0bce
4
+ data.tar.gz: 87ad8d68d7fc9092610f55a6f52ef0c21a29515d
5
5
  SHA512:
6
- metadata.gz: ca9e11cab8ed683ec3fe79f8630994fedc1b9f4c0e26f02946cc10592f892aa99f22087467248d9269d75d8d701c8b429719fb6955959e86c5e7515899d47eeb
7
- data.tar.gz: 50132b33bdf4c21c979ba74563a67b4bd32f7c06569a26584ba0b64ad7e248d2ec46c9db96c5c320820f4f37467aaf6aad300fa6216e973bcca63e49f52ebe84
6
+ metadata.gz: ece5916c1221a6d6b2b0db271145e20749e98cc2c3ae671990fc19f773ab678cf6ded57db909c11c615d986c6974cf669d509964a4fa69778c17f8ba7ac21f0a
7
+ data.tar.gz: e6ccc8914eb4f40405a3ac081fc831c362ee7e2c7add9d5b6859fcc55674f9521389244c017ffca4f80790610a97b87e4c04e9ed29bd0e2e3a4dec0966c305e2
data/Gemfile CHANGED
@@ -5,6 +5,7 @@ gem "nokogiri"
5
5
 
6
6
  group :development, :test do
7
7
  gem "pry-byebug"
8
+ gem "rspec"
8
9
  gem "rspec-rails"
9
10
  end
10
11
 
@@ -14,6 +14,7 @@ require "gotransverse-tract-api/billing_account/reason"
14
14
  require "gotransverse-tract-api/billing_account/recurring_payment"
15
15
  require "gotransverse-tract-api/billing_account/refund"
16
16
  require "gotransverse-tract-api/billing_account/scheduled_charge"
17
+ require "gotransverse-tract-api/billing_account/standard_invoice_adjustment_application"
17
18
 
18
19
  require "gotransverse-tract-api/general/system_setting"
19
20
 
@@ -212,8 +213,8 @@ module GoTransverseTractApi
212
213
 
213
214
  klass = klass.to_s.split("::").last
214
215
  hsh = Hash.from_xml(xml_response.to_s)
215
-
216
216
  hsh = hsh[klass.pluralize.camelize(:lower)][klass.camelize(:lower)] rescue Hash.from_xml(xml_response.to_s)[klass.camelize(:lower)]
217
+
217
218
  return hsh
218
219
  rescue
219
220
  {}
@@ -4,8 +4,93 @@ module GoTransverseTractApi
4
4
 
5
5
  class Adjustment
6
6
 
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} eid
11
+ #
12
+ def find_by_eid eid
13
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
14
+ end
15
+
16
+ #
17
+ # @param {Long} account_num
18
+ #
19
+ def find_by_account_num account_num
20
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
21
+ end
22
+
23
+ #
24
+ # @param {Long} billing_account_eid
25
+ #
26
+ def find_by_billing_account_eid billing_account_eid
27
+ GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
28
+ end
29
+
30
+ #
31
+ # @param {Long} invoice_num
32
+ #
33
+ def find_by_invoice_num invoice_num
34
+ GoTransverseTractApi.get_response_for(self, {invoice_num: invoice_num})
35
+ end
36
+
37
+ #
38
+ # @param {Long} invoice_eid
39
+ #
40
+ def find_by_invoice_eid invoice_eid
41
+ GoTransverseTractApi.get_response_for(self, {invoice_eid: invoice_eid})
42
+ end
43
+
44
+ #
45
+ # @param {String} status
46
+ #
47
+ def find_by_status status
48
+ GoTransverseTractApi.get_response_for(self, {status: status})
49
+ end
50
+
51
+ #
52
+ # @param {Long} eid
53
+ # @param {Hash} adjustment
54
+ #
55
+ def post eid, adjustment
56
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, adjustment, "post")
57
+ end
58
+
59
+ #
60
+ # @param {Long} eid
61
+ # @param {Hash} adjustment
62
+ #
63
+ def reverse eid, adjustment
64
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, adjustment, "reverse")
65
+ end
66
+
67
+ #
68
+ # @param {Long} eid
69
+ # @param {Hash} adjustment
70
+ #
71
+ def add_invoice_application eid, adjustment
72
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, adjustment, "addInvoiceApplication")
73
+ end
74
+
75
+ #
76
+ # @param {Long} eid
77
+ # @param {Hash} adjustment
78
+ #
79
+ def reverse_invoice_application eid, adjustment
80
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, adjustment, "reverseInvoiceApplication")
81
+ end
82
+
83
+ #
84
+ # @param {Hash} adjustment
85
+ #
86
+ def create_adjustment adjustment
87
+ GoTransverseTractApi.post_request_for(self, {}, adjustment, "")
88
+ end
89
+
90
+ end
91
+
7
92
  end
8
93
 
9
94
  end
10
95
 
11
- end
96
+ end
@@ -0,0 +1,30 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class AdjustmentApplication
6
+
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} eid
11
+ #
12
+ def find_by_eid eid
13
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
14
+ end
15
+
16
+ #
17
+ # @param {Long} adjustment_eid
18
+ #
19
+ def find_by_adjustment_eid adjustment_eid
20
+ GoTransverseTractApi.get_response_for(self, {adjustment_eid: adjustment_eid})
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
@@ -4,12 +4,44 @@ module GoTransverseTractApi
4
4
 
5
5
  class AdjustmentReason
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+
9
+ def find_all
10
+ GoTransverseTractApi.get_response_for(self)
11
+ end
12
+
13
+ #
14
+ # @param {Long} eid
15
+ #
16
+ def find_by_eid eid
17
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
18
+ end
19
+
20
+ #
21
+ # @param {String} name
22
+ #
23
+ def find_by_name name
24
+ GoTransverseTractApi.get_response_for(self, {name: name})
25
+ end
26
+
27
+ #
28
+ # @param {String} status
29
+ #
30
+ def find_by_status status
31
+ GoTransverseTractApi.get_response_for(self, {status: status})
32
+ end
33
+
34
+ #
35
+ # @param {Boolean} credit_only
36
+ #
37
+ def find_by_credit_only credit_only
38
+ GoTransverseTractApi.get_response_for(self, {credit_only: credit_only})
39
+ end
40
+
9
41
  end
10
42
 
11
43
  end
12
44
 
13
45
  end
14
46
 
15
- end
47
+ end
@@ -4,12 +4,238 @@ module GoTransverseTractApi
4
4
 
5
5
  class BillingAccount
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+ def find_all
9
+ GoTransverseTractApi.get_response_for(self)
10
+ end
11
+
12
+ #
13
+ # @param {Long} eid
14
+ #
15
+ def find_by_eid eid
16
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
17
+ end
18
+
19
+ #
20
+ # @param {Long} account_num
21
+ #
22
+ def find_by_account_num account_num
23
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
24
+ end
25
+
26
+ #
27
+ # @param {Long} external_account_num
28
+ #
29
+ def find_by_external_account_num external_account_num
30
+ GoTransverseTractApi.get_response_for(self, {external_account_num: external_account_num})
31
+ end
32
+
33
+ #
34
+ # @param {Long} party_eid
35
+ #
36
+ def find_by_party_eid party_eid
37
+ GoTransverseTractApi.get_response_for(self, {party_eid: party_eid})
38
+ end
39
+
40
+ #
41
+ # @param {String} status
42
+ #
43
+ def find_by_status status
44
+ GoTransverseTractApi.get_response_for(self, {status: status})
45
+ end
46
+
47
+ #
48
+ # @param {String} email_address
49
+ #
50
+ def find_by_email_address email_address
51
+ GoTransverseTractApi.get_response_for(self, {email_address: email_address})
52
+ end
53
+
54
+ #
55
+ # @param {Long} billing_account_category_eid
56
+ #
57
+ def find_by_billing_account_category_eid billing_account_category_eid
58
+ GoTransverseTractApi.get_response_for(self, {billing_account_category_eid: billing_account_category_eid})
59
+ end
60
+
61
+ #
62
+ # @param {Long} purchase_order_number
63
+ #
64
+ def find_by_purchase_order_number purchase_order_number
65
+ GoTransverseTractApi.get_response_for(self, {purchase_order_number: purchase_order_number})
66
+ end
67
+
68
+ #
69
+ # @param {Long} order_num
70
+ #
71
+ def find_by_order_num order_num
72
+ GoTransverseTractApi.get_response_for(self, {order_num: order_num})
73
+ end
74
+
75
+ #
76
+ # @param {Long} custom_field_value_eid
77
+ #
78
+ def find_by_custom_field_value_eid custom_field_value_eid
79
+ GoTransverseTractApi.get_response_for(self, {custom_field_value_eid: custom_field_value_eid})
80
+ end
81
+
82
+ #
83
+ # @param {String} bill_type
84
+ #
85
+ def find_by_bill_type bill_type
86
+ GoTransverseTractApi.get_response_for(self, {bill_type: bill_type})
87
+ end
88
+
89
+ #
90
+ # @param {String} referral
91
+ #
92
+ def find_by_referral referral
93
+ GoTransverseTractApi.get_response_for(self, {referral: referral})
94
+ end
95
+
96
+ #
97
+ # @param {Long} billing_account_segment_eid
98
+ #
99
+ def find_by_billing_account_segment_eid billing_account_segment_eid
100
+ GoTransverseTractApi.get_response_for(self, {billing_account_segment_eid: billing_account_segment_eid})
101
+ end
102
+
103
+ #
104
+ # @param {String} currency_type
105
+ #
106
+ def find_by_currency_type currency_type
107
+ GoTransverseTractApi.get_response_for(self, {currency_type: currency_type})
108
+ end
109
+
110
+ #
111
+ # @param {Long} product_eid
112
+ #
113
+ def find_by_product_eid product_eid
114
+ GoTransverseTractApi.get_response_for(self, {product_eid: product_eid})
115
+ end
116
+
117
+ #
118
+ # @param {Long} service_eid
119
+ #
120
+ def find_by_service_eid service_eid
121
+ GoTransverseTractApi.get_response_for(self, {service_eid: service_eid})
122
+ end
123
+
124
+ #
125
+ # @param {Long} eid
126
+ # @param {Hash} billing_account
127
+ #
128
+ def apply_payment eid, billing_account
129
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "applyPayment")
130
+ end
131
+
132
+ #
133
+ # @param {Long} eid
134
+ # @param {Hash} billing_account
135
+ #
136
+ def suspend eid, billing_account
137
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "suspend")
138
+ end
139
+
140
+ #
141
+ # @param {Long} eid
142
+ # @param {Hash} billing_account
143
+ #
144
+ def resume eid, billing_account
145
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "resume")
146
+ end
147
+
148
+ #
149
+ # @param {Long} eid
150
+ # @param {Hash} billing_account
151
+ #
152
+ def add_recurring_payment eid, billing_account
153
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "addRecurringPayment")
154
+ end
155
+
156
+ #
157
+ # @param {Long} eid
158
+ # @param {Hash} billing_account
159
+ #
160
+ def change_service eid, billing_account
161
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "changeService")
162
+ end
163
+
164
+ #
165
+ # @param {Long} eid
166
+ # @param {Hash} billing_account
167
+ #
168
+ def add_custom_field_value eid, billing_account
169
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "addCustomFieldValue")
170
+ end
171
+
172
+ #
173
+ # @param {Long} eid
174
+ # @param {Hash} billing_account
175
+ #
176
+ def remove_custom_field_value eid, billing_account
177
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "removeCustomFieldValue")
178
+ end
179
+
180
+ #
181
+ # @param {Long} eid
182
+ # @param {Hash} billing_account
183
+ #
184
+ def add_person eid, billing_account
185
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "addPerson")
186
+ end
187
+
188
+ #
189
+ # @param {Long} eid
190
+ # @param {Hash} billing_account
191
+ #
192
+ def remove_billing_account eid, billing_account
193
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "removePerson")
194
+ end
195
+
196
+ #
197
+ # @param {Long} eid
198
+ # @param {Hash} billing_account
199
+ #
200
+ def create_draft_order eid, billing_account
201
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "createDraftOrder")
202
+ end
203
+
204
+ #
205
+ # @param {Long} eid
206
+ # @param {Hash} billing_account
207
+ #
208
+ def void_draft_order eid, billing_account
209
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "voidDraftOrder")
210
+ end
211
+
212
+ #
213
+ # @param {Long} eid
214
+ # @param {Hash} billing_account
215
+ #
216
+ def deactivate eid, billing_account
217
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, billing_account, "deactivate")
218
+ end
219
+
220
+ #
221
+ # @param {Hash} billing_account
222
+ #
223
+ def create_billing_account billing_account
224
+ GoTransverseTractApi.post_request_for(self, {}, billing_account, "")
225
+ end
226
+
227
+ #
228
+ # @param {Long} eid
229
+ # @param {Hash} billing_account
230
+ #
231
+ def update eid, billing_account
232
+ GoTransverseTractApi.put_request_for(self, {eid: eid}, billing_account)
233
+ end
234
+
9
235
  end
10
236
 
11
237
  end
12
238
 
13
239
  end
14
240
 
15
- end
241
+ end
@@ -0,0 +1,79 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class Counter
6
+
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} eid
11
+ #
12
+ def find_by_eid eid
13
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
14
+ end
15
+
16
+ #
17
+ # @param {Long} service_eid
18
+ #
19
+ def find_by_service_eid service_eid
20
+ GoTransverseTractApi.get_response_for(self, {service_eid: service_eid})
21
+ end
22
+
23
+ #
24
+ # @param {String} name
25
+ #
26
+ def find_by_name name
27
+ GoTransverseTractApi.get_response_for(self, {name: name})
28
+ end
29
+
30
+ #
31
+ # @param {String} status
32
+ #
33
+ def find_by_status status
34
+ GoTransverseTractApi.get_response_for(self, {status: status})
35
+ end
36
+
37
+ #
38
+ # @param {String} type
39
+ #
40
+ def find_by_type type
41
+ GoTransverseTractApi.get_response_for(self, {type: type})
42
+ end
43
+
44
+ #
45
+ # @param {String} entity_relation_type
46
+ #
47
+ def find_by_entity_relation_type entity_relation_type
48
+ GoTransverseTractApi.get_response_for(self, {entity_relation_type: entity_relation_type})
49
+ end
50
+
51
+ #
52
+ # @param {DateTime} from_date
53
+ #
54
+ def find_by_from_date from_date
55
+ GoTransverseTractApi.get_response_for(self, {from_date: from_date})
56
+ end
57
+
58
+ #
59
+ # @param {DateTime} thru_date
60
+ #
61
+ def find_by_thru_date thru_date
62
+ GoTransverseTractApi.get_response_for(self, {thru_date: thru_date})
63
+ end
64
+
65
+ #
66
+ # @param {Long} eid
67
+ # @param {Hash} counter
68
+ #
69
+ def update eid, counter
70
+ GoTransverseTractApi.put_request_for(self, {eid: eid}, counter)
71
+ end
72
+
73
+ end
74
+
75
+ end
76
+
77
+ end
78
+
79
+ end
@@ -4,12 +4,51 @@ module GoTransverseTractApi
4
4
 
5
5
  class CustomField
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+
9
+ def find_all
10
+ GoTransverseTractApi.get_response_for(self)
11
+ end
12
+
13
+ #
14
+ # @param {Long} eid
15
+ #
16
+ def find_by_eid eid
17
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
18
+ end
19
+
20
+ #
21
+ # @param {String} name
22
+ #
23
+ def find_by_name name
24
+ GoTransverseTractApi.get_response_for(self, {name: name})
25
+ end
26
+
27
+ #
28
+ # @param {String} type
29
+ #
30
+ def find_by_type type
31
+ GoTransverseTractApi.get_response_for(self, {type: type})
32
+ end
33
+
34
+ #
35
+ # @param {Boolean} enabled
36
+ #
37
+ def find_by_enabled enabled
38
+ GoTransverseTractApi.get_response_for(self, {enabled: enabled})
39
+ end
40
+
41
+ #
42
+ # @param {Boolean} searchable
43
+ #
44
+ def find_by_searchable searchable
45
+ GoTransverseTractApi.get_response_for(self, {searchable: searchable})
46
+ end
47
+
9
48
  end
10
49
 
11
50
  end
12
51
 
13
52
  end
14
53
 
15
- end
54
+ end
@@ -4,12 +4,93 @@ module GoTransverseTractApi
4
4
 
5
5
  class CustomFieldValue
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+
9
+ def find_all
10
+ GoTransverseTractApi.get_response_for(self)
11
+ end
12
+
13
+ #
14
+ # @param {Long} eid
15
+ #
16
+ def find_by_eid eid
17
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
18
+ end
19
+
20
+ #
21
+ # @param {Long} account_num
22
+ #
23
+ def find_by_account_num account_num
24
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
25
+ end
26
+
27
+ #
28
+ # @param {Long} external_account_num
29
+ #
30
+ def find_by_external_account_num external_account_num
31
+ GoTransverseTractApi.get_response_for(self, {external_account_num: external_account_num})
32
+ end
33
+
34
+ #
35
+ # @param {Long} billing_account_eid
36
+ #
37
+ def find_by_billing_account_eid billing_account_eid
38
+ GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
39
+ end
40
+
41
+ #
42
+ # @param {Long} custom_field_eid
43
+ #
44
+ def find_by_custom_field_eid custom_field_eid
45
+ GoTransverseTractApi.get_response_for(self, {custom_field_eid: custom_field_eid})
46
+ end
47
+
48
+ #
49
+ # @param {Long} order_eid
50
+ #
51
+ def find_by_order_eid order_eid
52
+ GoTransverseTractApi.get_response_for(self, {order_eid: order_eid})
53
+ end
54
+
55
+ #
56
+ # @param {Long} service_eid
57
+ #
58
+ def find_by_service_eid service_eid
59
+ GoTransverseTractApi.get_response_for(self, {service_eid: service_eid})
60
+ end
61
+
62
+ #
63
+ # @param {Long} order_item_eid
64
+ #
65
+ def find_by_order_item_eid order_item_eid
66
+ GoTransverseTractApi.get_response_for(self, {order_item_eid: order_item_eid})
67
+ end
68
+
69
+ #
70
+ # @param {Long} order_num
71
+ #
72
+ def find_by_order_num order_num
73
+ GoTransverseTractApi.get_response_for(self, {order_num: order_num})
74
+ end
75
+
76
+ #
77
+ # @param {String} custom_field_name
78
+ #
79
+ def find_by_custom_field_name custom_field_name
80
+ GoTransverseTractApi.get_response_for(self, {custom_field_name: custom_field_name})
81
+ end
82
+
83
+ #
84
+ # @param {Long} value
85
+ #
86
+ def find_by_value value
87
+ GoTransverseTractApi.get_response_for(self, {value: value})
88
+ end
89
+
9
90
  end
10
91
 
11
92
  end
12
93
 
13
94
  end
14
95
 
15
- end
96
+ end
@@ -4,8 +4,85 @@ module GoTransverseTractApi
4
4
 
5
5
  class Invoice
6
6
 
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} eid
11
+ #
12
+ def find_by_eid eid
13
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
14
+ end
15
+
16
+ #
17
+ # @param {Long} account_num
18
+ #
19
+ def find_by_account_num account_num
20
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
21
+ end
22
+
23
+ #
24
+ # @param {Long} billing_account_eid
25
+ #
26
+ def find_by_billing_account_eid billing_account_eid
27
+ GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
28
+ end
29
+
30
+ #
31
+ # @param {Long} invoice_num
32
+ #
33
+ def find_by_invoice_num invoice_num
34
+ GoTransverseTractApi.get_response_for(self, {invoice_num: invoice_num})
35
+ end
36
+
37
+ #
38
+ # @param {Long} event_eid
39
+ #
40
+ def find_by_event_eid event_eid
41
+ GoTransverseTractApi.get_response_for(self, {event_eid: event_eid})
42
+ end
43
+
44
+ #
45
+ # @param {String} status
46
+ #
47
+ def find_by_status status
48
+ GoTransverseTractApi.get_response_for(self, {status: status})
49
+ end
50
+
51
+ #
52
+ # @param {DateTime} occurred_on
53
+ #
54
+ def find_by_occurred_on occurred_on
55
+ GoTransverseTractApi.get_response_for(self, {occurred_on: occurred_on})
56
+ end
57
+
58
+ #
59
+ # @param {Long} adjustment_eid
60
+ #
61
+ def find_by_adjustment_eid adjustment_eid
62
+ GoTransverseTractApi.get_response_for(self, {adjustment_eid: adjustment_eid})
63
+ end
64
+
65
+ #
66
+ # @param {DateTime} where_invoice
67
+ #
68
+ # Example
69
+ # whereInvoice=(occurredOn gte '2011-06-15' and occurredOn lte '2011-07-13')
70
+ def find_by_where_invoice where_invoice
71
+ GoTransverseTractApi.get_response_for(self, {where_invoice: where_invoice})
72
+ end
73
+
74
+ #
75
+ # @param {Long} eid
76
+ # @param {Hash} invoice
77
+ #
78
+ def apply_payment eid, invoice
79
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, invoice, "applyPayment")
80
+ end
81
+
82
+ end
83
+
7
84
  end
8
85
 
9
86
  end
10
87
 
11
- end
88
+ end
@@ -4,8 +4,33 @@ module GoTransverseTractApi
4
4
 
5
5
  class InvoiceItem
6
6
 
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} eid
11
+ #
12
+ def find_by_eid eid
13
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
14
+ end
15
+
16
+ #
17
+ # @param {Long} invoice_num
18
+ #
19
+ def find_by_invoice_num invoice_num
20
+ GoTransverseTractApi.get_response_for(self, {invoice_num: invoice_num})
21
+ end
22
+
23
+ #
24
+ # @param {Long} invoice_eid
25
+ #
26
+ def find_by_invoice_eid invoice_eid
27
+ GoTransverseTractApi.get_response_for(self, {invoice_eid: invoice_eid})
28
+ end
29
+
30
+ end
31
+
7
32
  end
8
33
 
9
34
  end
10
35
 
11
- end
36
+ end
@@ -2,10 +2,21 @@ module GoTransverseTractApi
2
2
 
3
3
  module BillingAccount
4
4
 
5
- class InvoiceItemCharge
5
+ class InvoiceItemCharge < InvoiceItem
6
+
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} invoice_item_eid
11
+ #
12
+ def find_by_invoice_item_eid invoice_item_eid
13
+ GoTransverseTractApi.get_response_for(self, {invoice_item_eid: invoice_item_eid})
14
+ end
15
+
16
+ end
6
17
 
7
18
  end
8
19
 
9
20
  end
10
21
 
11
- end
22
+ end
@@ -4,8 +4,97 @@ module GoTransverseTractApi
4
4
 
5
5
  class Payment
6
6
 
7
+ #
8
+ # @param {Long} eid
9
+ #
10
+ def self.find_by_eid eid
11
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
12
+ end
13
+
14
+ #
15
+ # @param {String} account_num
16
+ #
17
+ def self.find_by_account_num account_num
18
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
19
+ end
20
+
21
+ #
22
+ # @param {Long} billing_account_eid
23
+ #
24
+ def self.find_by_billing_account_eid billing_account_eid
25
+ GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
26
+ end
27
+
28
+ #
29
+ # @param {DateTime} occured_on
30
+ #
31
+ def self.find_by_occured_on occured_on
32
+ GoTransverseTractApi.get_response_for(self, {occured_on: occured_on})
33
+ end
34
+
35
+ #
36
+ # @param {String} reference
37
+ #
38
+ def self.find_by_reference reference
39
+ GoTransverseTractApi.get_response_for(self, {reference: reference})
40
+ end
41
+
42
+ #
43
+ # @param {String} status
44
+ #
45
+ def self.find_by_status status
46
+ GoTransverseTractApi.get_response_for(self, {status: status})
47
+ end
48
+
49
+ #
50
+ # @param {String} authorization
51
+ #
52
+ def self.find_by_authorization authorization
53
+ GoTransverseTractApi.get_response_for(self, {authorization: authorization})
54
+ end
55
+
56
+ #
57
+ # @param {String} error_url
58
+ # @param {String} cancel_url
59
+ # @param {String} complete_url
60
+ #
61
+ def self.add_referrer_token_for error_url, cancel_url, complete_url
62
+ GoTransverseTractApi.post_request_for(self, {error_url: error_url, cancel_url: cancel_url, complete_url: complete_url}, {}, "referrerToken")
63
+ end
64
+
65
+ #
66
+ # @param {Long} eid
67
+ # @param {Hash} payment
68
+ #
69
+ def self.apply_refund eid, payment
70
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, payment, "applyRefund")
71
+ end
72
+
73
+ #
74
+ # @param {Long} eid
75
+ # @param {Hash} payment
76
+ #
77
+ def self.cancel eid, payment
78
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, payment, "cancel")
79
+ end
80
+
81
+ #
82
+ # @param {Long} eid
83
+ # @param {Hash} payment
84
+ #
85
+ def self.reallocate eid, payment
86
+ GoTransverseTractApi.post_request_for(self, {eid: eid}, payment, "reallocate")
87
+ end
88
+
89
+ #
90
+ # @param {Hash} payment
91
+ #
92
+ def self.create_payment payment
93
+ GoTransverseTractApi.post_request_for(self, {}, payment, "")
94
+ end
95
+
7
96
  end
8
97
 
9
98
  end
10
99
 
11
- end
100
+ end
@@ -4,12 +4,37 @@ module GoTransverseTractApi
4
4
 
5
5
  class Reason
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+
9
+ def find_all
10
+ GoTransverseTractApi.get_response_for(self)
11
+ end
12
+
13
+ #
14
+ # @param {Long} eid
15
+ #
16
+ def find_by_eid eid
17
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
18
+ end
19
+
20
+ #
21
+ # @param {String} name
22
+ #
23
+ def find_by_name name
24
+ GoTransverseTractApi.get_response_for(self, {name: name})
25
+ end
26
+
27
+ #
28
+ # @param {String} type
29
+ #
30
+ def find_by_type type
31
+ GoTransverseTractApi.get_response_for(self, {type: type})
32
+ end
33
+
9
34
  end
10
35
 
11
36
  end
12
37
 
13
38
  end
14
39
 
15
- end
40
+ end
@@ -4,12 +4,37 @@ module GoTransverseTractApi
4
4
 
5
5
  class RecurringPayment
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+
9
+ def self.find_all
10
+ GoTransverseTractApi.get_response_for(self)
11
+ end
12
+
13
+ #
14
+ # @param {Long} eid
15
+ #
16
+ def find_by_eid eid
17
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
18
+ end
19
+
20
+ #
21
+ # @param {Long} account_num
22
+ #
23
+ def find_by_account_num account_num
24
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
25
+ end
26
+
27
+ #
28
+ # @param {Long} billing_account_eid
29
+ #
30
+ def find_by_billing_account_eid billing_account_eid
31
+ GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
32
+ end
33
+
9
34
  end
10
35
 
11
36
  end
12
37
 
13
38
  end
14
39
 
15
- end
40
+ end
@@ -8,8 +8,71 @@ module GoTransverseTractApi
8
8
  GoTransverseTractApi.get_response_for(self)
9
9
  end
10
10
 
11
+ #
12
+ # @param {Long} eid
13
+ #
14
+ def self.find_by_eid eid
15
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
16
+ end
17
+
18
+ #
19
+ # @param {Long} payment_eid
20
+ #
21
+ def self.find_by_payment_eid payment_eid
22
+ GoTransverseTractApi.get_response_for(self, {payment_eid: payment_eid})
23
+ end
24
+
25
+ #
26
+ # @param {String} account_num
27
+ #
28
+ def self.find_by_account_num account_num
29
+ GoTransverseTractApi.get_response_for(self, {account_num: account_num})
30
+ end
31
+
32
+ #
33
+ # @param {Long} billing_account_eid
34
+ #
35
+ def self.find_by_billing_account_eid billing_account_eid
36
+ GoTransverseTractApi.get_response_for(self, {billing_account_eid: billing_account_eid})
37
+ end
38
+
39
+ #
40
+ # @param {DateTime} occured_on
41
+ #
42
+ def self.find_by_occured_on occured_on
43
+ GoTransverseTractApi.get_response_for(self, {occured_on: occured_on})
44
+ end
45
+
46
+ #
47
+ # @param {String} reference
48
+ #
49
+ def self.find_by_reference reference
50
+ GoTransverseTractApi.get_response_for(self, {reference: reference})
51
+ end
52
+
53
+ #
54
+ # @param {String} status
55
+ #
56
+ def self.find_by_status status
57
+ GoTransverseTractApi.get_response_for(self, {status: status})
58
+ end
59
+
60
+ #
61
+ # @param {String} authorization
62
+ #
63
+ def self.find_by_authorization authorization
64
+ GoTransverseTractApi.get_response_for(self, {authorization: authorization})
65
+ end
66
+
67
+ #
68
+ # @param {Hash} refund
69
+ #
70
+ def self.create_refund refund
71
+ GoTransverseTractApi.post_request_for(self, {}, refund, "")
72
+ end
73
+
11
74
  end
12
75
 
13
76
  end
14
77
 
15
- end
78
+ end
@@ -4,12 +4,44 @@ module GoTransverseTractApi
4
4
 
5
5
  class ScheduledCharge
6
6
 
7
- def self.find_all
8
- GoTransverseTractApi.get_response_for(self)
7
+ class << self
8
+
9
+ def find_all
10
+ GoTransverseTractApi.get_response_for(self)
11
+ end
12
+
13
+ #
14
+ # @param {Long} eid
15
+ #
16
+ def find_by_eid eid
17
+ GoTransverseTractApi.get_response_for(self, {eid: eid})
18
+ end
19
+
20
+ #
21
+ # @param {Long} service_price_eid
22
+ #
23
+ def find_by_service_price_eid service_price_eid
24
+ GoTransverseTractApi.get_response_for(self, {service_price_eid: service_price_eid})
25
+ end
26
+
27
+ #
28
+ # @param {Boolean} invoiced
29
+ #
30
+ def find_by_invoiced invoiced
31
+ GoTransverseTractApi.get_response_for(self, {invoiced: invoiced})
32
+ end
33
+
34
+ #
35
+ # @param {Long} order_item_eid
36
+ #
37
+ def find_by_order_item_eid order_item_eid
38
+ GoTransverseTractApi.get_response_for(self, {order_item_eid: order_item_eid})
39
+ end
40
+
9
41
  end
10
42
 
11
43
  end
12
44
 
13
45
  end
14
46
 
15
- end
47
+ end
@@ -0,0 +1,29 @@
1
+ module GoTransverseTractApi
2
+
3
+ module BillingAccount
4
+
5
+ class StandardInvoiceAdjustmentApplication < AdjustmentApplication
6
+
7
+ class << self
8
+
9
+ #
10
+ # @param {Long} invoice_eid
11
+ #
12
+ def find_by_invoice_eid invoice_eid
13
+ GoTransverseTractApi.get_response_for(self, {invoice_eid: invoice_eid})
14
+ end
15
+
16
+ #
17
+ # @param {Long} invoice_num
18
+ #
19
+ def find_by_invoice_num invoice_num
20
+ GoTransverseTractApi.get_response_for(self, {invoice_num: invoice_num})
21
+ end
22
+
23
+ end
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
@@ -1,6 +1,6 @@
1
1
  module GoTransverseTractApi
2
2
 
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.4"
4
4
  TARGET_API_VERSION = "1.28"
5
5
 
6
6
  end
@@ -0,0 +1,11 @@
1
+ module AuthHelper
2
+
3
+ def http_auth
4
+ GoTransverseTractApi.configure do |config|
5
+ config.username = ENV["GOTRANSVERSE_TRACT_USERNAME"]
6
+ config.password = ENV["GOTRANSVERSE_TRACT_PASSWORD"]
7
+ config.tract_api_host = ENV["GOTRANSVERSE_TRACT_API_HOST"]
8
+ end
9
+ end
10
+
11
+ end
@@ -7,17 +7,15 @@ module GoTransverseTractApi
7
7
 
8
8
  context ".find_all" do
9
9
  it "returns all products" do
10
- response = described_class.find_all
11
- num_of_products = response.css('products').children.count
12
- expect(num_of_products).to be > 1
10
+ data = described_class.find_all
11
+ expect(data.count).to be > 1
13
12
  end
14
13
  end
15
14
 
16
15
  context ".find_by_eid" do
17
16
  it "returns a product for the given eid" do
18
- response = described_class.find_by_eid(50)
19
- data = Hash.from_xml(response.to_s)
20
- expect(data['products']['product']['eid']).to eq('50')
17
+ data = described_class.find_by_eid(50)
18
+ expect(data['eid']).to eq('50')
21
19
  end
22
20
  end
23
21
  end
data/spec/spec_helper.rb CHANGED
@@ -2,9 +2,9 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
2
  ENV["RAILS_ENV"] ||= 'test'
3
3
 
4
4
  require 'gotransverse-tract-api'
5
- require 'rspec'
6
5
  require 'pry'
7
6
  require 'active_support/all'
7
+ require 'auth_helper'
8
8
 
9
9
  #require 'factory_girl'
10
10
  #require 'ffaker'
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.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien DeFrance
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-11-24 00:00:00.000000000 Z
12
+ date: 2015-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -118,8 +118,10 @@ files:
118
118
  - gotransverse-tract-api.gemspec
119
119
  - lib/gotransverse-tract-api.rb
120
120
  - lib/gotransverse-tract-api/billing_account/adjustment.rb
121
+ - lib/gotransverse-tract-api/billing_account/adjustment_application.rb
121
122
  - lib/gotransverse-tract-api/billing_account/adjustment_reason.rb
122
123
  - lib/gotransverse-tract-api/billing_account/billing_account.rb
124
+ - lib/gotransverse-tract-api/billing_account/counter.rb
123
125
  - lib/gotransverse-tract-api/billing_account/custom_field.rb
124
126
  - lib/gotransverse-tract-api/billing_account/custom_field_value.rb
125
127
  - lib/gotransverse-tract-api/billing_account/invoice.rb
@@ -130,6 +132,7 @@ files:
130
132
  - lib/gotransverse-tract-api/billing_account/recurring_payment.rb
131
133
  - lib/gotransverse-tract-api/billing_account/refund.rb
132
134
  - lib/gotransverse-tract-api/billing_account/scheduled_charge.rb
135
+ - lib/gotransverse-tract-api/billing_account/standard_invoice_adjustment_application.rb
133
136
  - lib/gotransverse-tract-api/configuration.rb
134
137
  - lib/gotransverse-tract-api/general/system_setting.rb
135
138
  - lib/gotransverse-tract-api/general_ledger/general_ledger.rb
@@ -191,6 +194,7 @@ files:
191
194
  - lib/gotransverse-tract-api/usage/usage_lookup_table_entry.rb
192
195
  - lib/gotransverse-tract-api/usage/usage_rule.rb
193
196
  - lib/gotransverse-tract-api/version.rb
197
+ - spec/auth_helper.rb
194
198
  - spec/gotransverse-tract-api/product/product_spec.rb
195
199
  - spec/spec_helper.rb
196
200
  homepage: https://rubygems.org/gems/gotransverse-tract-api
@@ -218,5 +222,6 @@ signing_key:
218
222
  specification_version: 4
219
223
  summary: A ruby gem allowing developers to integrate with GoTransverse's TRACT API.
220
224
  test_files:
225
+ - spec/auth_helper.rb
221
226
  - spec/gotransverse-tract-api/product/product_spec.rb
222
227
  - spec/spec_helper.rb