Class: Openlive::MasterBuilder

Inherits:
Base
  • Object
show all
Defined in:
lib/openlive/master_builder.rb

Instance Attribute Summary

Attributes inherited from Base

#api_data, #response

Class Method Summary collapse

Methods inherited from Base

connection, #connection, handle_response, #initialize, #method_missing, #oauth, oauth, #refresh

Constructor Details

This class inherits a constructor from Openlive::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Openlive::Base

Class Method Details

.allArray<MasterBuilder>

Fetch and return a list of all master builder units

Returns:

Raises:

  • (APIError)

    Will raise an error on unsuccessful response



21
22
23
24
25
26
27
28
29
# File 'lib/openlive/master_builder.rb', line 21

def all
  response = Request.get("masterbuilders")

  handle_response(response, error_class: Openlive::APIError) do |response|
    response.body['data'].map do |mb|
      new(mb, response: response)
    end
  end
end

.find(id) ⇒ MasterBuilder

Find and return a masterbuilder record

Parameters:

  • id (String)

Returns:

Raises:

  • (APIError)

    Will raise an error on unsuccessful response



9
10
11
12
13
14
15
# File 'lib/openlive/master_builder.rb', line 9

def find(id)
  response = Request.get("masterbuilders/#{id}")

  handle_response(response, error_class: APIError) do |response|
    new(response.body, response: response)
  end
end