Class: Ebay::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ebay/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize ⇒ Configuration

Returns a new instance of Configuration.



15
16
17
18
19
20
# File 'lib/ebay/configuration.rb', line 15

def initialize
  @base_url = "https://api.ebay.com"
  @sandbox = false
  @timeout = 30
  @marketplace_id = "EBAY_US"
end

Instance Attribute Details

#app_id ⇒ Object

Returns the value of attribute app_id.



7
8
9
# File 'lib/ebay/configuration.rb', line 7

def app_id
  @app_id
end

#base_url ⇒ Object

Returns the value of attribute base_url.



5
6
7
# File 'lib/ebay/configuration.rb', line 5

def base_url
  @base_url
end

#client_id ⇒ Object

Returns the value of attribute client_id.



5
6
7
# File 'lib/ebay/configuration.rb', line 5

def client_id
  @client_id
end

#client_secret ⇒ Object

Returns the value of attribute client_secret.



5
6
7
# File 'lib/ebay/configuration.rb', line 5

def client_secret
  @client_secret
end

#marketplace_id ⇒ Object

Returns the value of attribute marketplace_id.



5
6
7
# File 'lib/ebay/configuration.rb', line 5

def marketplace_id
  @marketplace_id
end

#sandbox ⇒ Object

Returns the value of attribute sandbox.



5
6
7
# File 'lib/ebay/configuration.rb', line 5

def sandbox
  @sandbox
end

#timeout ⇒ Object

Returns the value of attribute timeout.



5
6
7
# File 'lib/ebay/configuration.rb', line 5

def timeout
  @timeout
end

Instance Method Details

#finding_url ⇒ Object



33
34
35
36
# File 'lib/ebay/configuration.rb', line 33

def finding_url
  warn "[DEPRECATION] finding_url is deprecated. The Finding API has been shut down by eBay."
  sandbox ? "https://svcs.sandbox.ebay.com/services/search/FindingService/v1" : "https://svcs.ebay.com/services/search/FindingService/v1"
end

#sandbox! ⇒ Object



22
23
24
25
26
# File 'lib/ebay/configuration.rb', line 22

def sandbox!
  @sandbox = true
  @base_url = "https://api.sandbox.ebay.com"
  self
end

#valid? ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
31
# File 'lib/ebay/configuration.rb', line 28

def valid?
  !client_id.nil? && !client_id.empty? &&
    !client_secret.nil? && !client_secret.empty?
end