Class: MHVAC::Client
- Inherits:
-
Common::Client::Base
- Object
- Common::Client::Base
- MHVAC::Client
- Defined in:
- lib/mhv_ac/client.rb
Overview
Core class responsible for MHVAC API interface operations
Instance Method Summary collapse
-
#get_countries ⇒ Hash
Get a list of available countries (used for registraion).
-
#get_states ⇒ Hash
Get a list of available states (used for registration).
- #nonauth_headers ⇒ Object private
-
#post_register(params) ⇒ Hash
Create an MHV account.
-
#post_upgrade(params) ⇒ Hash
Upgrade an MHV account.
Methods inherited from Common::Client::Base
#config, configuration, #connection, #delete, #get, #perform, #post, #put, #raise_backend_exception, #raise_not_authenticated, #request, #sanitize_headers!, #service_name
Methods included from SentryLogging
#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata
Instance Method Details
#get_countries ⇒ Hash
These two lists (state and country) should be cached for any given day.
Get a list of available countries (used for registraion)
49 50 51 |
# File 'lib/mhv_ac/client.rb', line 49 def get_countries perform(:get, 'enum/countries', nil, nonauth_headers).body end |
#get_states ⇒ Hash
These two lists (state and country) should be cached for any given day
Get a list of available states (used for registration)
40 41 42 |
# File 'lib/mhv_ac/client.rb', line 40 def get_states perform(:get, 'enum/states', nil, nonauth_headers).body end |
#nonauth_headers ⇒ Object (private)
55 56 57 |
# File 'lib/mhv_ac/client.rb', line 55 def nonauth_headers config.base_request_headers.merge('appToken' => config.app_token) end |
#post_register(params) ⇒ Hash
Create an MHV account
20 21 22 23 |
# File 'lib/mhv_ac/client.rb', line 20 def post_register(params) form = MHVAC::RegistrationForm.new(params) perform(:post, 'account/register', form.mhv_params, nonauth_headers).body end |
#post_upgrade(params) ⇒ Hash
Upgrade an MHV account
30 31 32 33 |
# File 'lib/mhv_ac/client.rb', line 30 def post_upgrade(params) form = MHVAC::UpgradeForm.new(params) perform(:post, 'account/upgrade', form.mhv_params, nonauth_headers).body end |