Module: MusicTodayApiWrapper

Defined in:
lib/resources/hash.rb,
lib/resources/image.rb,
lib/resources/string.rb,
lib/resources/address.rb,
lib/resources/product.rb,
lib/resources/variant.rb,
lib/support/configuration.rb,
lib/music_today_api_wrapper.rb,
lib/resources/purchase/item.rb,
lib/resources/checkout/order.rb,
lib/services/product_services.rb,
lib/resources/checkout/session.rb,
lib/resources/purchase/invoice.rb,
lib/services/checkout_services.rb,
lib/services/shipping_services.rb,
lib/rest_clients/common_response.rb,
lib/resources/checkout/destination.rb,
lib/resources/checkout/billing/payment.rb,
lib/resources/purchase/shipping_option.rb,
lib/resources/checkout/billing/customer.rb,
lib/rest_clients/music_today_rest_client.rb

Defined Under Namespace

Modules: Resources, RestClients, Services Classes: Configuration, RestClient

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



8
9
10
# File 'lib/music_today_api_wrapper.rb', line 8

def configuration
  @configuration
end

Class Method Details

.checkout(address, items) ⇒ Object



31
32
33
34
# File 'lib/music_today_api_wrapper.rb', line 31

def self.checkout(address, items)
  checkout_services = Services::CheckoutServices.new
  checkout_services.checkout(address, items)
end

.configure {|configuration| ... } ⇒ Object

Yields:



11
12
13
14
# File 'lib/music_today_api_wrapper.rb', line 11

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration)
end

.find_product(id) ⇒ Object



21
22
23
24
# File 'lib/music_today_api_wrapper.rb', line 21

def self.find_product(id)
  product_services = Services::ProductServices.new
  product_services.find_product(id)
end

.products(per_page = 1000, page_number = nil) ⇒ Object



16
17
18
19
# File 'lib/music_today_api_wrapper.rb', line 16

def self.products(per_page = 1000, page_number = nil)
  product_services = Services::ProductServices.new
  product_services.all_products(per_page, page_number)
end

.purchase(order, check_price = true) ⇒ Object



36
37
38
39
40
# File 'lib/music_today_api_wrapper.rb', line 36

def self.purchase(order, check_price = true)
  checkout_services = Services::CheckoutServices.new
  return checkout_services.only_purchase(order) unless check_price
  checkout_services.confirm_and_purchase(order) if check_price
end

.shipping_options(address, items) ⇒ Object



26
27
28
29
# File 'lib/music_today_api_wrapper.rb', line 26

def self.shipping_options(address, items)
  shipping_services = Services::ShippingServices.new
  shipping_services.options(address, items)
end