Module: Amiando
- Defined in:
- lib/amiando.rb,
lib/amiando/sync.rb,
lib/amiando/user.rb,
lib/amiando/event.rb,
lib/amiando/utils.rb,
lib/amiando/result.rb,
lib/amiando/api_key.rb,
lib/amiando/autorun.rb,
lib/amiando/boolean.rb,
lib/amiando/partner.rb,
lib/amiando/request.rb,
lib/amiando/version.rb,
lib/amiando/resource.rb,
lib/amiando/attributes.rb,
lib/amiando/ticket_shop.rb,
lib/amiando/ticket_type.rb,
lib/amiando/payment_type.rb,
lib/amiando/public/event.rb,
lib/amiando/ticket_category.rb
Defined Under Namespace
Modules: Attributes, Autorun, Public, Utils Classes: ApiKey, Boolean, Error, Event, Partner, PaymentType, Request, Resource, Result, Sync, TicketCategory, TicketShop, TicketType, User
Constant Summary collapse
- URL =
'https://www.amiando.com'
- TEST_URL =
'https://test.amiando.com'
- VERSION =
"0.6.0"
Class Attribute Summary collapse
-
.api_key ⇒ Object
Api key to be used at all times.
-
.autorun ⇒ Object
If set to true, will run the requests automatically when needed.
-
.base_url ⇒ String
The url for the environment.
-
.default_options ⇒ Object
Set default options for typhoeus.
-
.logger ⇒ Object
Logger instance.
-
.timeout ⇒ Object
Timeout value (in milliseconds).
-
.verbose ⇒ Object
Returns the value of attribute verbose.
Class Method Summary collapse
-
.development! ⇒ Object
Connect to the test server (default).
-
.production! ⇒ Object
Connect to the production server.
- .requests ⇒ Object
-
.run ⇒ Object
Runs all queued requests.
-
.with_key(key) ⇒ Object
Allows to switch temporarily the API key.
Class Attribute Details
.api_key ⇒ Object
Api key to be used at all times.
45 46 47 |
# File 'lib/amiando.rb', line 45 def api_key @api_key end |
.autorun ⇒ Object
If set to true, will run the requests automatically when needed.
53 54 55 |
# File 'lib/amiando.rb', line 53 def autorun @autorun end |
.base_url ⇒ String
Returns the url for the environment.
78 79 80 |
# File 'lib/amiando.rb', line 78 def base_url @base_url || (@production ? URL : TEST_URL) end |
.default_options ⇒ Object
Set default options for typhoeus
62 63 64 |
# File 'lib/amiando.rb', line 62 def @default_options end |
.logger ⇒ Object
Logger instance. There’s no logger by default.
48 49 50 |
# File 'lib/amiando.rb', line 48 def logger @logger end |
.timeout ⇒ Object
Timeout value (in milliseconds). Default: 15 seconds.
59 60 61 |
# File 'lib/amiando.rb', line 59 def timeout @timeout end |
.verbose ⇒ Object
Returns the value of attribute verbose.
50 51 52 |
# File 'lib/amiando.rb', line 50 def verbose @verbose end |
Class Method Details
.development! ⇒ Object
Connect to the test server (default)
73 74 75 |
# File 'lib/amiando.rb', line 73 def development! @production = false end |
.production! ⇒ Object
Connect to the production server
68 69 70 |
# File 'lib/amiando.rb', line 68 def production! @production = true end |
.requests ⇒ Object
82 83 84 |
# File 'lib/amiando.rb', line 82 def requests @requests ||= [] end |
.run ⇒ Object
Runs all queued requests
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/amiando.rb', line 87 def run exception = nil requests.each { |request| hydra.queue(request) } ActiveSupport::Notifications.instrument("run.amiando", :calls => requests.size) do begin hydra.run rescue Exception => exception end end raise exception if exception ensure @requests = [] end |