Class: Rimu::RimuAPI::Orders

Inherits:
Rimu::RimuAPI show all
Defined in:
lib/rimu/orders.rb

Instance Attribute Summary

Attributes inherited from Rimu::RimuAPI

#logger

Instance Method Summary collapse

Methods inherited from Rimu::RimuAPI

#api_key, #api_url, #billing_methods, #convert_item, #distributions, #error?, #error_message, #format_response, has_namespace, #initialize, #prep_data, #read_timeout, #send_request, #set_headers

Constructor Details

This class inherits a constructor from Rimu::RimuAPI

Instance Method Details

#order(oid) ⇒ Object

Raises:

  • (ArgumentError)


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

def order(oid)
    raise ArgumentError, "oid should be an Integer" unless oid.is_a?(Integer)
    send_request("/r/orders/order-#{oid}-dn", "about_order")
end

#orders(params = {}) ⇒ Object

Raises:

  • (ArgumentError)


5
6
7
8
9
10
11
12
13
14
# File 'lib/rimu/orders.rb', line 5

def orders(params={})
    raise ArgumentError, "params should be a hash" unless params.is_a?(Hash)
    default_params = {
        :include_inactive => 'N',
        :server_type => 'VPS',
    }
    filters = prep_data(default_params, params)
    path = "/r/orders;" + filters.collect {|k,v| "#{k}=#{CGI::escape(v.to_s)}"}.join(';')
    send_request(path, "about_orders")
end