billfixers-partner 1.1.5 → 1.2.1

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
  SHA256:
3
- metadata.gz: 887f18bf6add9dbdc5341d7de66b397bf53109b68c26691acb0146769ffd7ec5
4
- data.tar.gz: d83744410ed12949d30ca8f23d57bb75ebdf18e3139b4919a84c10a4eb18c18e
3
+ metadata.gz: e5d6ff6a126177cb75dee8df02d1c0a3c9f97d0e6f86bb716f6baf406b0fc811
4
+ data.tar.gz: 4bfa0b1d80a879c8b7bdc72f63260254ab20148a7dc92d4bf78384b78cb8e06a
5
5
  SHA512:
6
- metadata.gz: 7798be4bed60d48593fb40529267c189dd965a0297e1f78b574bcee68c8445b8b7d94de99c48b5aaba9640c9979fb97ad79492ea122335c80600d9ca93e81513
7
- data.tar.gz: bed72fc93e2a90264adaa10d9423e433445f64022f03cfd45be6a2ee9e0ae6b2c6bee873453e545e3e63b564b97e672ce7ba04810482ac8e25888518da36aaa4
6
+ metadata.gz: e6435d70558a67fccf6512c7801aa95800a530488067f3f39082dae20d5d27f6b9527c8318fb03341b1a48cd509e2f8757bcdbe563ecd5dc4f1b3b5756750198
7
+ data.tar.gz: 65fadf82b078607800af37cce8b7805e804e6d994b9c03ea977c8774633c0cbecc1b3f2795b36554f2ccc1c9b30cc6f6e5bb9aa59d3220de03bef87b0ad9b42b
@@ -6,14 +6,13 @@ require 'graphlient'
6
6
  module Billfixers
7
7
  module Partner
8
8
  class Client
9
- def initialize(email:, token:, test_mode: false)
10
- endpoint = test_mode ? 'https://billfixers-staging.herokuapp.com/partner/graphql' : 'https://billfixers.herokuapp.com/partner/graphql'
9
+ def initialize(api_key:, test_mode: false)
10
+ endpoint = test_mode ? 'https://billfixers-partner-sandbox.herokuapp.com/partner/graphql' : 'https://billfixers.herokuapp.com/partner/graphql'
11
11
 
12
12
  @gql = Graphlient::Client.new(endpoint,
13
13
  schema_path: File.join(File.dirname(__FILE__), '../../../partner_schema.json'),
14
14
  headers: {
15
- "X-PartnerUser-Email": email,
16
- "X-PartnerUser-Token": token
15
+ "X-Partner-ApiKey": api_key
17
16
  })
18
17
  end
19
18
 
@@ -103,9 +102,10 @@ module Billfixers
103
102
  result.customer
104
103
  end
105
104
 
106
- def create_bill(customer_id, params)
105
+ def create_bill(customer_id, provider_id, params)
107
106
  response = @gql.query(CREATE_BILL_MUTATION, {
108
107
  customer_id: customer_id,
108
+ provider_id: provider_id,
109
109
  bill: camelize(params)
110
110
  })
111
111
 
@@ -115,6 +115,18 @@ module Billfixers
115
115
  result.bill
116
116
  end
117
117
 
118
+ def update_bill(bill_id, params)
119
+ response = @gql.query(UPDATE_BILL_MUTATION, {
120
+ bill_id: bill_id,
121
+ bill: camelize(params)
122
+ })
123
+
124
+ result = response.data.update_bill
125
+ raise Error, result.errors.join(' ') unless result.success
126
+
127
+ result.bill
128
+ end
129
+
118
130
  def renegotiate_bill(bill_id)
119
131
  response = @gql.query(RENEGOTIATE_BILL_MUTATION, { id: bill_id })
120
132
 
@@ -48,6 +48,8 @@ module Billfixers
48
48
  totalSavings
49
49
  createdAt
50
50
  updatedAt
51
+ autoRenegotiate
52
+ allowsContract
51
53
 
52
54
  items {
53
55
  #{BILL_ITEM_FRAGMENT}
@@ -209,8 +211,20 @@ module Billfixers
209
211
  )
210
212
 
211
213
  CREATE_BILL_MUTATION = %(
212
- mutation($customer_id: ID!, $bill: BillAttributes!) {
213
- CreateBill(input: { customerId: $customer_id, bill: $bill }) {
214
+ mutation($customer_id: ID!, $provider_id: ID!, $bill: BillAttributes!) {
215
+ CreateBill(input: { customerId: $customer_id, providerId: $provider_id, bill: $bill }) {
216
+ success
217
+ errors
218
+ bill {
219
+ #{BILL_FRAGMENT}
220
+ }
221
+ }
222
+ }
223
+ )
224
+
225
+ UPDATE_BILL_MUTATION = %(
226
+ mutation($bill_id: ID!, $bill: BillAttributes!) {
227
+ UpdateBill(input: { billId: $bill_id, bill: $bill }) {
214
228
  success
215
229
  errors
216
230
  bill {
@@ -285,21 +299,21 @@ module Billfixers
285
299
 
286
300
  CALCULATE_SAVINGS_ESTIMATE = %(
287
301
  query(
288
- $providerId: ID!
289
- $currentMonthlyAmount: Float!
302
+ $provider_id: ID!
303
+ $current_monthly_amount: Float!
290
304
  ) {
291
305
  CalculateSavingsEstimate {
292
306
  estimatedAnnualSavings(
293
- providerId: $providerId
294
- currentMonthlyAmount: $currentMonthlyAmount
307
+ providerId: $provider_id
308
+ currentMonthlyAmount: $current_monthly_amount
295
309
  )
296
310
  estimatedMonthlySavings(
297
- providerId: $providerId
298
- currentMonthlyAmount: $currentMonthlyAmount
311
+ providerId: $provider_id
312
+ currentMonthlyAmount: $current_monthly_amount
299
313
  )
300
314
  percentageSavings(
301
- providerId: $providerId
302
- currentMonthlyAmount: $currentMonthlyAmount
315
+ providerId: $provider_id
316
+ currentMonthlyAmount: $current_monthly_amount
303
317
  )
304
318
  }
305
319
  }
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Billfixers
4
4
  module Partner
5
- VERSION = '1.1.5'
5
+ VERSION = '1.2.1'
6
6
  end
7
7
  end
data/partner_schema.json CHANGED
@@ -388,20 +388,6 @@
388
388
  "description": "Attributes for creating or updating a bill",
389
389
  "fields": null,
390
390
  "inputFields": [
391
- {
392
- "name": "providerId",
393
- "description": "The ID of the Provider",
394
- "type": {
395
- "kind": "NON_NULL",
396
- "name": null,
397
- "ofType": {
398
- "kind": "SCALAR",
399
- "name": "ID",
400
- "ofType": null
401
- }
402
- },
403
- "defaultValue": null
404
- },
405
391
  {
406
392
  "name": "last4ssn",
407
393
  "description": "The last 4 digits of the customer's social security number",
@@ -459,16 +445,6 @@
459
445
  }
460
446
  },
461
447
  "defaultValue": null
462
- },
463
- {
464
- "name": "createdVia",
465
- "description": null,
466
- "type": {
467
- "kind": "SCALAR",
468
- "name": "String",
469
- "ofType": null
470
- },
471
- "defaultValue": null
472
448
  }
473
449
  ],
474
450
  "interfaces": null,
@@ -639,7 +615,21 @@
639
615
  "inputFields": [
640
616
  {
641
617
  "name": "customerId",
642
- "description": null,
618
+ "description": "The ID of the customer",
619
+ "type": {
620
+ "kind": "NON_NULL",
621
+ "name": null,
622
+ "ofType": {
623
+ "kind": "SCALAR",
624
+ "name": "ID",
625
+ "ofType": null
626
+ }
627
+ },
628
+ "defaultValue": null
629
+ },
630
+ {
631
+ "name": "providerId",
632
+ "description": "The ID of the provider",
643
633
  "type": {
644
634
  "kind": "NON_NULL",
645
635
  "name": null,
@@ -1107,16 +1097,6 @@
1107
1097
  },
1108
1098
  "defaultValue": null
1109
1099
  },
1110
- {
1111
- "name": "externalId",
1112
- "description": null,
1113
- "type": {
1114
- "kind": "SCALAR",
1115
- "name": "String",
1116
- "ofType": null
1117
- },
1118
- "defaultValue": null
1119
- },
1120
1100
  {
1121
1101
  "name": "firstName",
1122
1102
  "description": null,
@@ -2467,6 +2447,33 @@
2467
2447
  "isDeprecated": false,
2468
2448
  "deprecationReason": null
2469
2449
  },
2450
+ {
2451
+ "name": "UpdateBill",
2452
+ "description": null,
2453
+ "args": [
2454
+ {
2455
+ "name": "input",
2456
+ "description": "Parameters for UpdateBill",
2457
+ "type": {
2458
+ "kind": "NON_NULL",
2459
+ "name": null,
2460
+ "ofType": {
2461
+ "kind": "INPUT_OBJECT",
2462
+ "name": "UpdateBillInput",
2463
+ "ofType": null
2464
+ }
2465
+ },
2466
+ "defaultValue": null
2467
+ }
2468
+ ],
2469
+ "type": {
2470
+ "kind": "OBJECT",
2471
+ "name": "UpdateBillPayload",
2472
+ "ofType": null
2473
+ },
2474
+ "isDeprecated": false,
2475
+ "deprecationReason": null
2476
+ },
2470
2477
  {
2471
2478
  "name": "UpdateCustomer",
2472
2479
  "description": null,
@@ -4770,6 +4777,130 @@
4770
4777
  "enumValues": null,
4771
4778
  "possibleTypes": null
4772
4779
  },
4780
+ {
4781
+ "kind": "INPUT_OBJECT",
4782
+ "name": "UpdateBillInput",
4783
+ "description": "Autogenerated input type of UpdateBill",
4784
+ "fields": null,
4785
+ "inputFields": [
4786
+ {
4787
+ "name": "billId",
4788
+ "description": null,
4789
+ "type": {
4790
+ "kind": "NON_NULL",
4791
+ "name": null,
4792
+ "ofType": {
4793
+ "kind": "SCALAR",
4794
+ "name": "ID",
4795
+ "ofType": null
4796
+ }
4797
+ },
4798
+ "defaultValue": null
4799
+ },
4800
+ {
4801
+ "name": "bill",
4802
+ "description": null,
4803
+ "type": {
4804
+ "kind": "NON_NULL",
4805
+ "name": null,
4806
+ "ofType": {
4807
+ "kind": "INPUT_OBJECT",
4808
+ "name": "BillAttributes",
4809
+ "ofType": null
4810
+ }
4811
+ },
4812
+ "defaultValue": null
4813
+ },
4814
+ {
4815
+ "name": "clientMutationId",
4816
+ "description": "A unique identifier for the client performing the mutation.",
4817
+ "type": {
4818
+ "kind": "SCALAR",
4819
+ "name": "String",
4820
+ "ofType": null
4821
+ },
4822
+ "defaultValue": null
4823
+ }
4824
+ ],
4825
+ "interfaces": null,
4826
+ "enumValues": null,
4827
+ "possibleTypes": null
4828
+ },
4829
+ {
4830
+ "kind": "OBJECT",
4831
+ "name": "UpdateBillPayload",
4832
+ "description": "Autogenerated return type of UpdateBill",
4833
+ "fields": [
4834
+ {
4835
+ "name": "bill",
4836
+ "description": null,
4837
+ "args": [],
4838
+ "type": {
4839
+ "kind": "OBJECT",
4840
+ "name": "Bill",
4841
+ "ofType": null
4842
+ },
4843
+ "isDeprecated": false,
4844
+ "deprecationReason": null
4845
+ },
4846
+ {
4847
+ "name": "clientMutationId",
4848
+ "description": "A unique identifier for the client performing the mutation.",
4849
+ "args": [],
4850
+ "type": {
4851
+ "kind": "SCALAR",
4852
+ "name": "String",
4853
+ "ofType": null
4854
+ },
4855
+ "isDeprecated": false,
4856
+ "deprecationReason": null
4857
+ },
4858
+ {
4859
+ "name": "errors",
4860
+ "description": null,
4861
+ "args": [],
4862
+ "type": {
4863
+ "kind": "NON_NULL",
4864
+ "name": null,
4865
+ "ofType": {
4866
+ "kind": "LIST",
4867
+ "name": null,
4868
+ "ofType": {
4869
+ "kind": "NON_NULL",
4870
+ "name": null,
4871
+ "ofType": {
4872
+ "kind": "SCALAR",
4873
+ "name": "String",
4874
+ "ofType": null
4875
+ }
4876
+ }
4877
+ }
4878
+ },
4879
+ "isDeprecated": false,
4880
+ "deprecationReason": null
4881
+ },
4882
+ {
4883
+ "name": "success",
4884
+ "description": null,
4885
+ "args": [],
4886
+ "type": {
4887
+ "kind": "NON_NULL",
4888
+ "name": null,
4889
+ "ofType": {
4890
+ "kind": "SCALAR",
4891
+ "name": "Boolean",
4892
+ "ofType": null
4893
+ }
4894
+ },
4895
+ "isDeprecated": false,
4896
+ "deprecationReason": null
4897
+ }
4898
+ ],
4899
+ "inputFields": null,
4900
+ "interfaces": [],
4901
+ "enumValues": null,
4902
+ "possibleTypes": null
4903
+ },
4773
4904
  {
4774
4905
  "kind": "INPUT_OBJECT",
4775
4906
  "name": "UpdateCustomerInput",
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: billfixers-partner
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.5
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - BillFixers
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-16 00:00:00.000000000 Z
11
+ date: 2021-08-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport