Class: TicketEvolution::Settings

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

Constant Summary

Constants included from Endpoint::RequestHandler

Endpoint::RequestHandler::CODES

Instance Method Summary collapse

Methods included from Modules::Show

#build_for_show, #show

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, #upload_history_handler

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



30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ticket_evolution/settings.rb', line 30

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



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/ticket_evolution/settings.rb', line 13

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



26
27
28
# File 'lib/ticket_evolution/settings.rb', line 26

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

#shipping(params = {}) ⇒ Object



9
10
11
# File 'lib/ticket_evolution/settings.rb', line 9

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

#shipping_setting(params = {}) ⇒ Object



5
6
7
# File 'lib/ticket_evolution/settings.rb', line 5

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

#singular_class(klass = self.class) ⇒ Object



43
44
45
# File 'lib/ticket_evolution/settings.rb', line 43

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