Sha256: cc7ebca00dcfe03b1c1f2b2c6eae00daee8e58c17360a1590f71e78333f53b18

Contents?: true

Size: 732 Bytes

Versions: 1

Compression:

Stored size: 732 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 create(attributes)
      DiscountNetwork.post_resource("account", subscriber: attributes)
    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

1 entries across 1 versions & 1 rubygems

Version Path
discountnetwork-0.1.3 lib/discountnetwork/account.rb