Sha256: c605a9a5037d4189a42b75a5e2cc856c97e7c1cce063815775ffc0479f617205

Contents?: true

Size: 625 Bytes

Versions: 3

Compression:

Stored size: 625 Bytes

Contents

module DiscountNetwork
  class Account < Base
    def find(auth_token = nil)
      set_account_auth_token(auth_token)
      if auth_token_exists?
        DiscountNetwork.get_resource("account").user
      end
    end

    def update(attributes)
      if auth_token_exists?
        DiscountNetwork.put_resource("account", subscriber: attributes)
      end
    end

    private

    def auth_token_exists?
      !DiscountNetwork.configuration.auth_token.nil?
    end

    def set_account_auth_token(auth_token)
      if !auth_token.nil?
        DiscountNetwork.configuration.auth_token = auth_token
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discountnetwork-0.1.2 lib/discountnetwork/account.rb
discountnetwork-0.1.1 lib/discountnetwork/account.rb
discountnetwork-0.1.0 lib/discountnetwork/account.rb