Class: MWS::Subscriptions

Inherits:
Peddler::Client show all
Defined in:
lib/mws/subscriptions.rb

Overview

The Amazon MWS Subscriptions API section enables you to subscribe to receive notifications that are relevant to your business with Amazon. With the operations in the Subscriptions API section, you can register to receive important information from Amazon without having to poll the Amazon MWS service. Instead, the information is sent directly to you when an event occurs to which you are subscribed.

Constant Summary

Constants inherited from Peddler::Client

Peddler::Client::BadMarketplaceId, Peddler::Client::HOSTS

Instance Attribute Summary

Attributes inherited from Peddler::Client

#body, #marketplace_id, #merchant_id

Instance Method Summary collapse

Methods inherited from Peddler::Client

#aws_endpoint, #headers, inherited, #operation, path, #run

Instance Method Details

#create_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Creates a new subscription



80
81
82
83
84
85
86
# File 'lib/mws/subscriptions.rb', line 80

def create_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
  operation('CreateSubscription')
    .add('MarketplaceId' => marketplace_id)
    .add(build_subscription(notification_type, sqs_queue_url))

  run
end

#delete_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Deletes a subscription



110
111
112
113
114
115
116
# File 'lib/mws/subscriptions.rb', line 110

def delete_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
  operation('DeleteSubscription')
    .add('MarketplaceId' => marketplace_id, 'NotificationType' => notification_type)
    .add(build_destination(sqs_queue_url))

  run
end

#deregister_destination(sqs_queue_url, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Removes an existing destination from the list of registered destinations



37
38
39
40
41
42
43
# File 'lib/mws/subscriptions.rb', line 37

def deregister_destination(sqs_queue_url, marketplace_id = marketplace_id)
  operation('DeregisterDestination')
    .add('MarketplaceId' => marketplace_id)
    .add(build_destination(sqs_queue_url))

  run
end

#get_service_statusPeddler::Parser

Gets the service status of the API



150
151
152
153
# File 'lib/mws/subscriptions.rb', line 150

def get_service_status
  operation('GetServiceStatus')
  run
end

#get_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Gets a subscription



95
96
97
98
99
100
101
# File 'lib/mws/subscriptions.rb', line 95

def get_subscription(notification_type, sqs_queue_url, marketplace_id = marketplace_id)
  operation('GetSubscription')
    .add('MarketplaceId' => marketplace_id, 'NotificationType' => notification_type)
    .add(build_destination(sqs_queue_url))

  run
end

#list_registered_destinations(marketplace_id = marketplace_id) ⇒ Peddler::Parser

Lists all registered destinations



50
51
52
53
54
55
# File 'lib/mws/subscriptions.rb', line 50

def list_registered_destinations( marketplace_id = marketplace_id)
  operation('ListRegisteredDestinations')
    .add('MarketplaceId' => marketplace_id)

  run
end

#list_subscriptions(marketplace_id = marketplace_id) ⇒ Peddler::Parser

Lists current subscriptions



123
124
125
126
127
128
# File 'lib/mws/subscriptions.rb', line 123

def list_subscriptions(marketplace_id = marketplace_id)
  operation('ListSubscriptions')
    .add('MarketplaceId' => marketplace_id)

  run
end

#register_destination(sqs_queue_url, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Registers a new destination to receive notifications



21
22
23
24
25
26
27
# File 'lib/mws/subscriptions.rb', line 21

def register_destination(sqs_queue_url, marketplace_id = marketplace_id)
  operation('RegisterDestination')
    .add('MarketplaceId' => marketplace_id)
    .add(build_destination(sqs_queue_url))

  run
end

#send_test_notification_to_destination(sqs_queue_url, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Sends a test notification to an existing destination



65
66
67
68
69
70
71
# File 'lib/mws/subscriptions.rb', line 65

def send_test_notification_to_destination(sqs_queue_url, marketplace_id = marketplace_id)
  operation('SendTestNotificationToDestination')
    .add('MarketplaceId' => marketplace_id)
    .add(build_destination(sqs_queue_url))

  run
end

#update_subscription(notification_type, sqs_queue_url, enabled, marketplace_id = marketplace_id) ⇒ Peddler::Parser

Updates a subscription



138
139
140
141
142
143
144
# File 'lib/mws/subscriptions.rb', line 138

def update_subscription(notification_type, sqs_queue_url, enabled, marketplace_id = marketplace_id)
  operation('CreateSubscription')
    .add('MarketplaceId' => marketplace_id)
    .add(build_subscription(notification_type, sqs_queue_url, enabled))

  run
end