Class: TicketEvolution::Settings

Inherits:
Endpoint show all
Defined in:
lib/ticket_evolution/settings.rb

Constant Summary

Constants included from Endpoint::RequestHandler

Endpoint::RequestHandler::CODES

Instance Method Summary collapse

Methods inherited from Endpoint

#base_path, #connection, #endpoint_name, #has_connection?, #id, #initialize, #method_missing

Methods included from Endpoint::RequestHandler

#build_request, #collection_handler, #naturalize_response, #raw_handler, #request

Methods inherited from Base

#method_missing

Constructor Details

This class inherits a constructor from TicketEvolution::Endpoint

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TicketEvolution::Endpoint

Instance Method Details

#build_for_service_fees(response) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/ticket_evolution/settings.rb', line 24

def build_for_service_fees(response)
  collection = TicketEvolution::Collection.new(
    :total_entries => response.body['total_entries']
  )

  response.body['settings'].each do |result|
    collection.entries << "TicketEvolution::ServiceFee".
      constantize.new(result.merge({:connection => connection}))
  end

  collection
end

#build_for_shipping(response) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/ticket_evolution/settings.rb', line 7

def build_for_shipping(response)
  collection = TicketEvolution::Collection.new(
    :total_entries => response.body['total_entries']
  )

  response.body['settings'].each do |result|
    collection.entries << "TicketEvolution::ShippingSetting".
      constantize.new(result.merge({:connection => connection}))
  end

  collection
end

#service_fees(params = {}) ⇒ Object



20
21
22
# File 'lib/ticket_evolution/settings.rb', line 20

def service_fees(params = {})
  request(:GET, "/service_fees", params, &method(:build_for_service_fees))
end

#shipping(params = {}) ⇒ Object



3
4
5
# File 'lib/ticket_evolution/settings.rb', line 3

def shipping(params = {})
  request(:GET, "/shipping", params, &method(:build_for_shipping))
end

#singular_class(klass = self.class) ⇒ Object



37
38
39
# File 'lib/ticket_evolution/settings.rb', line 37

def singular_class(klass = self.class)
  TicketEvolution::ShippingSetting
end