Sha256: d42f85fc81b06e4a690cabff817a020aaebc87df105260e99e91d1b08e3b2958

Contents?: true

Size: 985 Bytes

Versions: 5

Compression:

Stored size: 985 Bytes

Contents

# -*- encoding : utf-8 -*-
class SklikApi
  class Client

    NAME = "client"

    include Object
        
    def initialize args = {}
      super args
    end
    
    def self.find args = {}
      out = connection.call("client.getAttributes") { |param|
        ([param[:user]]|param[:foreignAccounts]).collect{|u| 
          u.symbolize_keys!
          SklikApi::Client.new(
            :customer_id => u[:userId],
            :email => u[:username],
            :agency_status => u[:agencyStatus],
            :wallet_credit => u[:walletCredit],
            :wallet_credit_with_vat => u[:walletCreditWithVat],
            :wallet_verified => u[:walletVerified],
            :day_budget_sum => u[:dayBudgetSum],
            :account_limit => u[:accountLimit]
          )
        }
      }
      out.select!{|c| c.args[:customer_id] == args[:customer_id]} if args[:customer_id]
      out.select!{|c| c.args[:email] == args[:email]} if args[:email]
      return out
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sklik-api-0.0.16 lib/sklik-api/client.rb
sklik-api-0.0.15 lib/sklik-api/client.rb
sklik-api-0.0.14 lib/sklik-api/client.rb
sklik-api-0.0.13 lib/sklik-api/client.rb
sklik-api-0.0.12 lib/sklik-api/client.rb