Module: Supercast

Defined in:
lib/supercast.rb,
lib/supercast/util.rb,
lib/supercast/client.rb,
lib/supercast/errors.rb,
lib/supercast/version.rb,
lib/supercast/resource.rb,
lib/supercast/response.rb,
lib/supercast/data_list.rb,
lib/supercast/singleton.rb,
lib/supercast/data_types.rb,
lib/supercast/data_object.rb,
lib/supercast/resources/role.rb,
lib/supercast/operations/list.rb,
lib/supercast/operations/save.rb,
lib/supercast/resources/invite.rb,
lib/supercast/operations/create.rb,
lib/supercast/resources/channel.rb,
lib/supercast/resources/creator.rb,
lib/supercast/resources/episode.rb,
lib/supercast/operations/destroy.rb,
lib/supercast/operations/request.rb,
lib/supercast/resources/subscriber.rb,
lib/supercast/resources/usage_alert.rb

Defined Under Namespace

Modules: DataTypes, Operations, Util Classes: APIConnectionError, APIError, AuthenticationError, Channel, Client, Creator, DataList, DataObject, Episode, InvalidRequestError, Invite, PermissionError, RateLimitError, Resource, Response, Role, Singleton, Subscriber, SupercastError, UsageAlert

Constant Summary collapse

VERSION =
'0.0.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_baseObject

Returns the value of attribute api_base.



62
63
64
# File 'lib/supercast.rb', line 62

def api_base
  @api_base
end

.api_keyObject

Returns the value of attribute api_key.



62
63
64
# File 'lib/supercast.rb', line 62

def api_key
  @api_key
end

.api_versionObject

Returns the value of attribute api_version.



62
63
64
# File 'lib/supercast.rb', line 62

def api_version
  @api_version
end

.initial_network_retry_delayObject (readonly)

Returns the value of attribute initial_network_retry_delay.



65
66
67
# File 'lib/supercast.rb', line 65

def initial_network_retry_delay
  @initial_network_retry_delay
end

.max_network_retry_delayObject (readonly)

Returns the value of attribute max_network_retry_delay.



65
66
67
# File 'lib/supercast.rb', line 65

def max_network_retry_delay
  @max_network_retry_delay
end

.open_timeoutObject

Returns the value of attribute open_timeout.



62
63
64
# File 'lib/supercast.rb', line 62

def open_timeout
  @open_timeout
end

.proxyObject

Returns the value of attribute proxy.



62
63
64
# File 'lib/supercast.rb', line 62

def proxy
  @proxy
end

.read_timeoutObject

Returns the value of attribute read_timeout.



62
63
64
# File 'lib/supercast.rb', line 62

def read_timeout
  @read_timeout
end

.verify_ssl_certsObject

Returns the value of attribute verify_ssl_certs.



62
63
64
# File 'lib/supercast.rb', line 62

def verify_ssl_certs
  @verify_ssl_certs
end

Class Method Details

.ca_bundle_pathObject

The location of a file containing a bundle of CA certificates. By default the library will use an included bundle that can successfully validate Supercast certificates.



71
72
73
# File 'lib/supercast.rb', line 71

def self.ca_bundle_path
  @ca_bundle_path
end

.ca_bundle_path=(path) ⇒ Object



75
76
77
78
79
80
# File 'lib/supercast.rb', line 75

def self.ca_bundle_path=(path)
  @ca_bundle_path = path

  # empty this field so a new store is initialized
  @ca_store = nil
end

.ca_storeObject

A certificate store initialized from the the bundle in #ca_bundle_path and which is used to validate TLS on every request.

This was added to the give the gem “pseudo thread safety” in that it seems when initiating many parallel requests marshaling the certificate store is the most likely point of failure. Any program attempting to leverage this pseudo safety should make a call to this method (i.e. ‘Supercast.ca_store`) in their initialization code because it marshals lazily and is itself not thread safe.



91
92
93
94
95
96
97
# File 'lib/supercast.rb', line 91

def self.ca_store
  @ca_store ||= begin
    store = OpenSSL::X509::Store.new
    store.add_file(ca_bundle_path)
    store
  end
end

.log_levelObject

When set prompts the library to log some extra information to $stdout and $stderr about what it’s doing. For example, it’ll produce information about requests, responses, and errors that are received. Valid log levels are ‘debug` and `info`, with `debug` being a little more verbose in places.

Use of this configuration is only useful when ‘.logger` is not set. When it is, the decision what levels to print is entirely deferred to the logger.



111
112
113
# File 'lib/supercast.rb', line 111

def self.log_level
  @log_level
end

.log_level=(val) ⇒ Object

Raises:

  • (ArgumentError)


115
116
117
118
119
# File 'lib/supercast.rb', line 115

def self.log_level=(val)
  raise ArgumentError, 'log_level should only be set to `nil`, `debug` or `info`' if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)

  @log_level = val
end

.loggerObject

Sets a logger to which logging output will be sent. The logger should support the same interface as the ‘Logger` class that’s part of Ruby’s standard library (hint, anything in ‘Rails.logger` will likely be suitable).

If ‘.logger` is set, the value of `.log_level` is ignored. The decision on what levels to print is entirely deferred to the logger.



128
129
130
# File 'lib/supercast.rb', line 128

def self.logger
  @logger
end

.logger=(val) ⇒ Object



132
133
134
# File 'lib/supercast.rb', line 132

def self.logger=(val)
  @logger = val
end

.max_network_retriesObject



136
137
138
# File 'lib/supercast.rb', line 136

def self.max_network_retries
  @max_network_retries
end

.max_network_retries=(val) ⇒ Object



140
141
142
# File 'lib/supercast.rb', line 140

def self.max_network_retries=(val)
  @max_network_retries = val.to_i
end