Class: Verizon::Configuration
- Defined in:
- lib/verizon/configuration.rb,
lib/verizon/models/configuration.rb
Overview
List of the field names and values to set.
Constant Summary collapse
- ENVIRONMENTS =
All the environments the SDK can run in.
{ Environment::PRODUCTION => { Server::EDGE_DISCOVERY => 'https://5gedge.verizon.com/api/mec/eds', Server::THINGSPACE => 'https://thingspace.verizon.com/api', Server::OAUTH_SERVER => 'https://thingspace.verizon.com/api/ts/v1', Server::M2M => 'https://thingspace.verizon.com/api/m2m', Server::DEVICE_LOCATION => 'https://thingspace.verizon.com/api/loc/v1', Server::SUBSCRIPTION_SERVER => 'https://thingspace.verizon.com/api/subsc/v1', Server::SOFTWARE_MANAGEMENT_V1 => 'https://thingspace.verizon.com/api/fota/v1', Server::SOFTWARE_MANAGEMENT_V2 => 'https://thingspace.verizon.com/api/fota/v2', Server::SOFTWARE_MANAGEMENT_V3 => 'https://thingspace.verizon.com/api/fota/v3', Server::PERFORMANCE => 'https://5gedge.verizon.com/api/mec', Server::DEVICE_DIAGNOSTICS => 'https://thingspace.verizon.com/api/diagnostics/v1', Server::CLOUD_CONNECTOR => 'https://thingspace.verizon.com/api/cc/v1', Server::HYPER_PRECISE_LOCATION => 'https://thingspace.verizon.com/api/hyper-precise/v1', Server::SERVICES => 'https://5gedge.verizon.com/api/mec/services', Server::QUALITY_OF_SERVICE => 'https://thingspace.verizon.com/api/m2m/v1/devices' } }.freeze
Class Attribute Summary collapse
-
.environments ⇒ Object
readonly
Returns the value of attribute environments.
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
The attribute readers for properties.
-
#frequency ⇒ String
TODO: Write general description for this method.
-
#oauth_2credentials ⇒ Object
readonly
The attribute readers for properties.
-
#thingspace_oauth_credentials ⇒ Object
readonly
The attribute readers for properties.
-
#vz_m2m_token ⇒ Object
readonly
The attribute readers for properties.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
- #clone_with(connection: nil, adapter: nil, timeout: nil, max_retries: nil, retry_interval: nil, backoff_factor: nil, retry_statuses: nil, retry_methods: nil, http_callback: nil, environment: nil, oauth_2credentials: nil, thingspace_oauth_credentials: nil, vz_m2m_token: nil) ⇒ Object
-
#get_base_uri(server = Server::EDGE_DISCOVERY) ⇒ String
Generates the appropriate base URI for the environment and the server.
-
#initialize(frequency = SKIP) ⇒ Configuration
constructor
A new instance of Configuration.
Methods inherited from BaseModel
Constructor Details
#initialize(frequency = SKIP) ⇒ Configuration
Returns a new instance of Configuration.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/verizon/configuration.rb', line 45 def initialize( connection: nil, adapter: :net_http_persistent, timeout: 60, max_retries: 0, retry_interval: 1, backoff_factor: 2, retry_statuses: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524], retry_methods: %i[get put], http_callback: nil, environment: Environment::PRODUCTION, oauth_2credentials: nil, thingspace_oauth_credentials: nil, vz_m2m_token: 'TODO: Replace' ) super connection: connection, adapter: adapter, timeout: timeout, max_retries: max_retries, retry_interval: retry_interval, backoff_factor: backoff_factor, retry_statuses: retry_statuses, retry_methods: retry_methods, http_callback: http_callback # Current API environment @environment = String(environment) # The object holding OAuth 2 Client Credentials Grant credentials @oauth_2credentials = oauth_2credentials # The object holding OAuth 2 Client Credentials Grant credentials @thingspace_oauth_credentials = thingspace_oauth_credentials # M2M Session Token ([How to generate an M2M session token?](page:getting-started/5g-edge-developer-creds-token#obtaining-a-vz-m2m-session-token-programmatically)) @vz_m2m_token = vz_m2m_token # The Http Client to use for making requests. set_http_client CoreLibrary::FaradayClient.new(self) end |
Class Attribute Details
.environments ⇒ Object (readonly)
Returns the value of attribute environments.
42 43 44 |
# File 'lib/verizon/configuration.rb', line 42 def environments @environments end |
Instance Attribute Details
#environment ⇒ Object (readonly)
The attribute readers for properties.
39 40 41 |
# File 'lib/verizon/configuration.rb', line 39 def environment @environment end |
#frequency ⇒ String
TODO: Write general description for this method
14 15 16 |
# File 'lib/verizon/models/configuration.rb', line 14 def frequency @frequency end |
#oauth_2credentials ⇒ Object (readonly)
The attribute readers for properties.
39 40 41 |
# File 'lib/verizon/configuration.rb', line 39 def oauth_2credentials @oauth_2credentials end |
#thingspace_oauth_credentials ⇒ Object (readonly)
The attribute readers for properties.
39 40 41 |
# File 'lib/verizon/configuration.rb', line 39 def thingspace_oauth_credentials @thingspace_oauth_credentials end |
#vz_m2m_token ⇒ Object (readonly)
The attribute readers for properties.
39 40 41 |
# File 'lib/verizon/configuration.rb', line 39 def vz_m2m_token @vz_m2m_token end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
40 41 42 43 44 45 46 47 48 |
# File 'lib/verizon/models/configuration.rb', line 40 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. frequency = hash.key?('frequency') ? hash['frequency'] : SKIP # Create object from extracted values. Configuration.new(frequency) end |
.names ⇒ Object
A mapping from model property names to API property names.
17 18 19 20 21 |
# File 'lib/verizon/models/configuration.rb', line 17 def self.names @_hash = {} if @_hash.nil? @_hash['frequency'] = 'frequency' @_hash end |
.nullables ⇒ Object
An array for nullable fields
31 32 33 |
# File 'lib/verizon/models/configuration.rb', line 31 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
24 25 26 27 28 |
# File 'lib/verizon/models/configuration.rb', line 24 def self.optionals %w[ frequency ] end |
Instance Method Details
#clone_with(connection: nil, adapter: nil, timeout: nil, max_retries: nil, retry_interval: nil, backoff_factor: nil, retry_statuses: nil, retry_methods: nil, http_callback: nil, environment: nil, oauth_2credentials: nil, thingspace_oauth_credentials: nil, vz_m2m_token: nil) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/verizon/configuration.rb', line 75 def clone_with(connection: nil, adapter: nil, timeout: nil, max_retries: nil, retry_interval: nil, backoff_factor: nil, retry_statuses: nil, retry_methods: nil, http_callback: nil, environment: nil, oauth_2credentials: nil, thingspace_oauth_credentials: nil, vz_m2m_token: nil) connection ||= self.connection adapter ||= self.adapter timeout ||= self.timeout max_retries ||= self.max_retries retry_interval ||= self.retry_interval backoff_factor ||= self.backoff_factor retry_statuses ||= self.retry_statuses retry_methods ||= self.retry_methods http_callback ||= self.http_callback environment ||= self.environment oauth_2credentials ||= self.oauth_2credentials thingspace_oauth_credentials ||= self.thingspace_oauth_credentials vz_m2m_token ||= self.vz_m2m_token Configuration.new( connection: connection, adapter: adapter, timeout: timeout, max_retries: max_retries, retry_interval: retry_interval, backoff_factor: backoff_factor, retry_statuses: retry_statuses, retry_methods: retry_methods, http_callback: http_callback, environment: environment, oauth_2credentials: oauth_2credentials, thingspace_oauth_credentials: thingspace_oauth_credentials, vz_m2m_token: vz_m2m_token ) end |
#get_base_uri(server = Server::EDGE_DISCOVERY) ⇒ String
Generates the appropriate base URI for the environment and the server. required.
131 132 133 |
# File 'lib/verizon/configuration.rb', line 131 def get_base_uri(server = Server::EDGE_DISCOVERY) ENVIRONMENTS[environment][server].clone end |