Class: ActiveFulfillment::Service

Inherits:
Object
  • Object
show all
Includes:
ActiveUtils::PostsData, ActiveUtils::RequiresParameters
Defined in:
lib/active_fulfillment/service.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Service

Returns a new instance of Service.



9
10
11
12
13
14
# File 'lib/active_fulfillment/service.rb', line 9

def initialize(options = {})
  check_test_mode(options)

  @options = {}
  @options.update(options)
end

Instance Method Details

#fetch_stock_levels(options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


33
34
35
# File 'lib/active_fulfillment/service.rb', line 33

def fetch_stock_levels(options = {})
  raise NotImplementedError.new("Subclasses must implement")
end

#fetch_tracking_data(order_ids, options = {}) ⇒ Object

Raises:

  • (NotImplementedError)


44
45
46
# File 'lib/active_fulfillment/service.rb', line 44

def fetch_tracking_data(order_ids, options = {})
  raise NotImplementedError.new("Subclasses must implement")
end

#fetch_tracking_numbers(order_ids, options = {}) ⇒ Object



37
38
39
40
41
42
# File 'lib/active_fulfillment/service.rb', line 37

def fetch_tracking_numbers(order_ids, options = {})
  response = fetch_tracking_data(order_ids, options)
  response.params.delete('tracking_companies')
  response.params.delete('tracking_urls')
  response
end

#fulfill(order_id, shipping_address, line_items, options = {}) ⇒ Object

API Requirements for Implementors

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/active_fulfillment/service.rb', line 29

def fulfill(order_id, shipping_address, line_items, options = {})
  raise NotImplementedError.new("Subclasses must implement")
end

#test?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/active_fulfillment/service.rb', line 20

def test?
  @options[:test] || Base.mode == :test
end

#test_mode?Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/active_fulfillment/service.rb', line 16

def test_mode?
  false
end

#valid_credentials?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/active_fulfillment/service.rb', line 24

def valid_credentials?
  true
end