Module: PayPal::SDK::REST::SetAPI

Included in:
RequestDataType
Defined in:
lib/paypal-sdk/rest/set_api.rb

Instance Method Summary collapse

Instance Method Details

#client_id=(client_id) ⇒ Object

Override client id



31
32
33
# File 'lib/paypal-sdk/rest/set_api.rb', line 31

def client_id=(client_id)
  set_config(:client_id => client_id).token = nil
end

#client_secret=(client_secret) ⇒ Object

Override client secret



36
37
38
# File 'lib/paypal-sdk/rest/set_api.rb', line 36

def client_secret=(client_secret)
  set_config(:client_secret => client_secret).token = nil
end

#set_config(*args) ⇒ Object Also known as: config=, set_api, api=

Set new api

Examples

payment.set_config(:development)
payment.set_config(:client_id => "XYZ", :client_secret => "SECRET")
payment.set_config
payment.api = API.new(:development)


11
12
13
14
15
16
17
18
19
# File 'lib/paypal-sdk/rest/set_api.rb', line 11

def set_config(*args)
  if args[0].is_a?(API)
    @api = args[0]
  else
    @api ||= API.new({})
    @api.set_config(*args)  # Just override the configuration and Not
    @api
  end
end

#token=(token) ⇒ Object Also known as: auth=

Override token



25
26
27
# File 'lib/paypal-sdk/rest/set_api.rb', line 25

def token=(token)
  set_config( :client_id => nil, :client_secret => nil ).token = token
end