Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

servicedaccountservice requires instantiation without customer_id

  • Loading branch information...
commit ddbc68d38574911e7c738f9f0d2f28f48b449c05 1 parent e6a96d6
Kequc Kequc authored
7 lib/adapi/api.rb
@@ -33,10 +33,9 @@ def initialize(params={})
33 33 end
34 34
35 35 def customer_id=(customer_id)
36   - if customer_id.present?
37   - @customer_id = customer_id.to_i
38   - Adapi::Config.set(:client_customer_id => @customer_id)
39   - end
  36 + @customer_id = customer_id.to_i
  37 + @customer_id = nil if @customer_id < 1
  38 + Adapi::Config.set(:client_customer_id => @customer_id)
40 39 end
41 40
42 41 def add_error(error_string)
7 lib/adapi/service_api.rb
@@ -110,10 +110,15 @@ def mutate_explicit(operator, operand)
110 110 self.mutate(operation)
111 111 end
112 112
  113 + def needs_customer_id?
  114 + return false if params[:service_name] == :ServicedAccountService
  115 + !@customer_id.present?
  116 + end
  117 +
113 118 def execute!(operation, method=:mutate)
114 119 response = nil
115 120 @attempts = 0
116   - raise "Service api request attempt without customer_id; #{operation.inspect}" unless @customer_id.present?
  121 + raise "Service api request attempt without customer_id; #{operation.inspect}" if needs_customer_id?
117 122
118 123 begin
119 124 @perform_retry = false
2  lib/adapi/serviced_account.rb
@@ -15,7 +15,7 @@ def self.find(amount=:all, params={})
15 15 end
16 16 params.symbolize_keys!
17 17
18   - response = self.get(nil, 0)
  18 + response = self.get(nil)
19 19 response = (response and response[:accounts]) ? response[:accounts] : []
20 20
21 21 found = nil

0 comments on commit ddbc68d

Please sign in to comment.
Something went wrong with that request. Please try again.