Class: YourMembership::Commerce

Inherits:
Object
  • Object
show all
Defined in:
lib/your_membership/commerce.rb

Overview

The Commerce Namespace does not currently have any methods in the YourMembership.com API. This is used for some helper methods.

Class Method Summary collapse

Class Method Details

.convert_order_status(status) ⇒ Integer

Converts some convenient Symbols to the Integer that the YourMembership API expects

Parameters:

  • status (Symbol)

    Accepts :cancelled, :open, :processed, :shipped

Returns:

  • (Integer)

    Returns the integer that the API expects



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/your_membership/commerce.rb', line 8

def self.convert_order_status(status)
  status_code = 0
  case status
  when :cancelled, :Cancelled
    status_code = -1
  when :open, :Open
    status_code = 0
  when :processed, :Processed
    status_code = 1
  when :shipped, :Shipped, :closed, :Closed
    status_code = 2
  else
    status_code = status
  end
  status_code
end