class DiscountNetwork::Account

Public Instance Methods

create(attributes) click to toggle source
# File lib/discountnetwork/account.rb, line 10
def create(attributes)
  DiscountNetwork.post_resource("account", subscriber: attributes)
end
find(auth_token = nil) click to toggle source
# File lib/discountnetwork/account.rb, line 3
def find(auth_token = nil)
  set_account_auth_token(auth_token)
  if auth_token_exists?
    DiscountNetwork.get_resource("account").user
  end
end
update(attributes) click to toggle source
# File lib/discountnetwork/account.rb, line 14
def update(attributes)
  if auth_token_exists?
    DiscountNetwork.put_resource("account", subscriber: attributes)
  end
end

Private Instance Methods

auth_token_exists?() click to toggle source
# File lib/discountnetwork/account.rb, line 22
def auth_token_exists?
  !DiscountNetwork.configuration.auth_token.nil?
end
set_account_auth_token(auth_token) click to toggle source
# File lib/discountnetwork/account.rb, line 26
def set_account_auth_token(auth_token)
  if !auth_token.nil?
    DiscountNetwork.configuration.auth_token = auth_token
  end
end