Class: Gemgento::API::SOAP::Sales::RecurringProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/gemgento/api/soap/sales/recurring_profile.rb

Class Method Summary collapse

Class Method Details

.fetch_allBoolean

Fetch and sync all recurring profiles from Magento.

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
# File 'lib/gemgento/api/soap/sales/recurring_profile.rb', line 10

def self.fetch_all
  if magento_profiles = list
    magento_profiles.each{ |source| sync_magento_to_local(source) }
    return true
  else
    return false
  end
end

.listArray(Hash), Boolean

Get a list of all recurring profiles from Magento.

Returns:

  • (Array(Hash), Boolean)


22
23
24
25
26
27
28
29
30
# File 'lib/gemgento/api/soap/sales/recurring_profile.rb', line 22

def self.list
  response = MagentoApi.create_call(:sales_recurring_profile_list)

  if response.success?
    return response.body[:result][:item].is_a?(Array) ? response.body[:result][:item] : [response.body[:result][:item]]
  else
    return false
  end
end

.update_state(profile_id, state) ⇒ Boolean

Update a recurring profile state in Magento.

Parameters:

  • profile_id (Integer)
  • state (String)

Returns:

  • (Boolean)


37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/gemgento/api/soap/sales/recurring_profile.rb', line 37

def self.update_state(profile_id, state)
  message = {
      profile_id: profile_id,
      state: state
  }
  response = MagentoApi.create_call(:sales_recurring_profile_update_state, message)

  if response.success?
    return true
  else
    return response.body[:faultstring]
  end
end