Module: Opera::MobileStoreSDK

Extended by:
ActiveSupport::Autoload
Defined in:
lib/opera-mobile-store-sdk.rb,
lib/opera/mobile_store_sdk/config.rb,
lib/opera/mobile_store_sdk/errors.rb,
lib/opera-mobile-store-sdk/version.rb,
lib/opera/mobile_store_sdk/api_accessible.rb,
lib/opera/mobile_store_sdk/api_object_list.rb,
lib/opera/mobile_store_sdk/identity_mapable.rb,
lib/opera/mobile_store_sdk/faraday_middleware/sdk_benchmark.rb,
lib/opera/mobile_store_sdk/faraday_middleware/authentication.rb,
lib/opera/mobile_store_sdk/faraday_middleware/response_parser.rb,
lib/opera/mobile_store_sdk/faraday_middleware/required_response_format.rb

Defined Under Namespace

Modules: APIAccessible, Errors, FaradayMiddleware, IdentityMapable Classes: APIObjectList, Config

Constant Summary collapse

VERSION =
"0.1.5"

Class Method Summary collapse

Class Method Details

.configObject



37
38
39
# File 'lib/opera-mobile-store-sdk.rb', line 37

def self.config
  @config ||= Opera::MobileStoreSDK::Config.new
end

.connectionObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/opera-mobile-store-sdk.rb', line 52

def self.connection
  @connection ||= Faraday.new(url: Opera::MobileStoreSDK.config.api_host) do |faraday|

    faraday.response :logger                  # log requests to STDOUT

    faraday.use MobileStoreSDK::FaradayMiddleware::RequiredResponseFormat

    faraday.use MobileStoreSDK::FaradayMiddleware::Authentication,
                MobileStoreSDK.config.username,
                MobileStoreSDK.config.password,
                authentication: MobileStoreSDK.config.authentication

    faraday.use MobileStoreSDK::FaradayMiddleware::ResponseParser

    faraday.use MobileStoreSDK::FaradayMiddleware::SDKBenchmark

    if defined?(Patron)
      faraday.adapter :patron
    else
      faraday.adapter Faraday.default_adapter  # make requests with Net::HTTP
    end
  end
end

.html_entitiesObject



45
46
47
48
49
50
# File 'lib/opera-mobile-store-sdk.rb', line 45

def self.html_entities
  @html_entities ||= begin
    require 'htmlentities'
    HTMLEntities.new
  end
end

.loggerObject



41
42
43
# File 'lib/opera-mobile-store-sdk.rb', line 41

def self.logger
  config.logger
end