billfixers-partner 1.1.4 → 1.2.0

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: 7e455d6938fcdbad9ead03ea10b45ea55a2ab1bbe20dc9122b836460c251c6a4
4
- data.tar.gz: fa3f60dd073845c7b9c706dd05301128e1da7bd824faee43b6485befbd42771b
3
+ metadata.gz: 664ff1de4959a3ffa7fab0eaaf7e664168abe420beab6cced0f456340fb8e7d1
4
+ data.tar.gz: 25802d198f8b2003e0b489d29426aa9ed35bf74f5c13459845bb4cc582de069f
5
5
  SHA512:
6
- metadata.gz: 60b851af21aeb5467fddc4ece69267b7b213f656a069d3fac39caecb39c60004b44b5f12af1e8ba8168b88d9a5487d3f346843f8d72e8ff660cfd49a18faa826
7
- data.tar.gz: ecf5f6c8bced4f53abf5dd47212447d0cda834a1f9f57d8de07e166c1d95fdc6597630a999cf7f6502d270824a4ae4a868cc5fb97dafd5de4f8f818593504da0
6
+ metadata.gz: d69a5a4faa111dde675cc0755c48874be48529a965b3130cb2bf2bee50b7866899e9267fdd6359d9eda0b041b1d6a97a99699d66014311fae8fd03817dcaca2e
7
+ data.tar.gz: ac2895eb75d835b0ec319ff89aaf363fa5feda664182c47d021cdb39cf4b7a3d42ed4378bcb9c3be4ba0fb07045b69848f4a0769267f1ecdb861b10a4724b0b4
data/Gemfile CHANGED
@@ -9,4 +9,9 @@ gem 'activesupport'
9
9
  gem 'graphlient'
10
10
  gem 'minitest', '~> 5.0'
11
11
  gem 'rake', '~> 12.0'
12
- gem 'webmock'
12
+ gem 'webmock'
13
+
14
+ group :development, :test do
15
+ # Call 'byebug' anywhere in the code to stop execution and get a debugger console
16
+ gem 'byebug', platform: :mri
17
+ end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- billfixers-partner (1.1.3)
4
+ billfixers-partner (1.1.4)
5
5
  activesupport
6
6
  graphlient
7
7
 
@@ -16,6 +16,7 @@ GEM
16
16
  zeitwerk (~> 2.2, >= 2.2.2)
17
17
  addressable (2.7.0)
18
18
  public_suffix (>= 2.0.2, < 5.0)
19
+ byebug (11.1.3)
19
20
  concurrent-ruby (1.1.7)
20
21
  crack (0.4.3)
21
22
  safe_yaml (~> 1.0.0)
@@ -54,6 +55,7 @@ PLATFORMS
54
55
  DEPENDENCIES
55
56
  activesupport
56
57
  billfixers-partner!
58
+ byebug
57
59
  graphlient
58
60
  minitest (~> 5.0)
59
61
  rake (~> 12.0)
@@ -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
 
@@ -128,7 +140,7 @@ module Billfixers
128
140
 
129
141
  raise Error, result.errors.join(' ') unless result.success
130
142
 
131
- result.success
143
+ result
132
144
  end
133
145
 
134
146
  def accept_offer(offer_id)
@@ -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 {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Billfixers
4
4
  module Partner
5
- VERSION = '1.1.4'
5
+ VERSION = '1.2.0'
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.4
4
+ version: 1.2.0
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-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport