Module: CatalogAPI

Defined in:
lib/catalogapi.rb,
lib/catalogapi/item.rb,
lib/catalogapi/order.rb,
lib/catalogapi/catalog.rb,
lib/catalogapi/request.rb,
lib/catalogapi/version.rb,
lib/catalogapi/category.rb,
lib/catalogapi/metadata.rb,
lib/catalogapi/order_item.rb,
lib/catalogapi/fulfillment.rb

Defined Under Namespace

Classes: Catalog, Category, Error, Fulfillment, Item, Metadata, Order, OrderItem, Request

Constant Summary collapse

VERSION =
'0.1.1'

Class Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Class Attribute Details

.environmentObject

Returns the value of attribute environment.



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

def environment
  @environment
end

.keyObject

Returns the value of attribute key.



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

def key
  @key
end

.tokenObject

Returns the value of attribute token.



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

def token
  @token
end

.usernameObject

Returns the value of attribute username.



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

def username
  @username
end

Class Method Details

.development?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/catalogapi.rb', line 19

def development?
  !production?
end

.production?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/catalogapi.rb', line 23

def production?
  environment == 'production'
end

.requestObject



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

def request
  CatalogAPI::Request
end

Instance Method Details

#catalog_breakdown(socket_id) ⇒ Services::OnlineRewards::Request

Parameters:

  • socket_id (String)

    the Socket ID from the list_available_catalogs

Returns:

  • (Services::OnlineRewards::Request)


39
40
41
# File 'lib/catalogapi.rb', line 39

def catalog_breakdown(socket_id)
  request.new(:catalog_breakdown).get(socket_id: socket_id)
end

#list_available_catalogsServices::OnlineRewards::Request

Returns request to the list_available_catalogs endpoint.

Returns:

  • (Services::OnlineRewards::Request)

    request to the list_available_catalogs endpoint



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

def list_available_catalogs
  request.new(:list_available_catalogs).get
end

#search_catalog(socket_id, search) ⇒ Services::OnlineRewards::Request

Parameters:

  • socket_id (String)

    the Socket ID from the list_available_catalogs

  • search (String)

    keywork to search for

Returns:

  • (Services::OnlineRewards::Request)


46
47
48
# File 'lib/catalogapi.rb', line 46

def search_catalog(socket_id, search)
  request.new(:search_catalog).get(socket_id: socket_id, search: search)
end