Module: WorkSnaps::Default
- Defined in:
- lib/worksnaps/default.rb
Constant Summary collapse
- ENDPOINT =
'http://www.worksnaps.net'
- CONNECTION_OPTIONS =
{ :headers => { :accept => 'application/xml', 'Content-Type' => 'application/xml', :user_agent => "WorkSnaps Ruby Gem #{WorkSnaps::Version}", }, :request => { :open_timeout => 5, :timeout => 10, }, :ssl => { :verify => false }, }
- IDENTITY_MAP =
false
- MIDDLEWARE =
Faraday::Builder.new do |builder| # Convert request params to "www-form-urlencoded" builder.use Faraday::Request::UrlEncoded # Parse response in XML format to hash builder.use WorkSnaps::Response::ParseXML # Handle 4xx server responses builder.use WorkSnaps::Response::RaiseError, WorkSnaps::Error::ClientError # Handle 5xx server responses builder.use WorkSnaps::Response::RaiseError, WorkSnaps::Error::ServerError # Set Faraday's HTTP adapter builder.adapter Faraday.default_adapter end
Class Method Summary collapse
- .api_tocken ⇒ String
- .connection_options ⇒ Object
- .consumer_key ⇒ String
- .consumer_secret ⇒ String
- .endpoint ⇒ Object
- .identity_map ⇒ Object
- .middleware ⇒ Faraday::Builder
- .oauth_token ⇒ String
- .oauth_token_secret ⇒ String
- .options ⇒ Object
Class Method Details
.api_tocken ⇒ String
48 49 50 |
# File 'lib/worksnaps/default.rb', line 48 def api_tocken ENV['WORKSNAPS_API_TOCKEN'] end |
.connection_options ⇒ Object
76 77 78 |
# File 'lib/worksnaps/default.rb', line 76 def CONNECTION_OPTIONS end |
.consumer_key ⇒ String
53 54 55 |
# File 'lib/worksnaps/default.rb', line 53 def consumer_key ENV['WORKSNAPS_CONSUMER_KEY'] end |
.consumer_secret ⇒ String
58 59 60 |
# File 'lib/worksnaps/default.rb', line 58 def consumer_secret ENV['WORKSNAPS_CONSUMER_SECRET'] end |
.endpoint ⇒ Object
72 73 74 |
# File 'lib/worksnaps/default.rb', line 72 def endpoint ENDPOINT end |
.identity_map ⇒ Object
80 81 82 |
# File 'lib/worksnaps/default.rb', line 80 def identity_map IDENTITY_MAP end |
.middleware ⇒ Faraday::Builder
Note:
Faraday’s middleware stack implementation is comparable to that of Rack middleware. The order of middleware is important: the first middleware on the list wraps all others, while the last middleware is the innermost one.
88 89 90 |
# File 'lib/worksnaps/default.rb', line 88 def middleware MIDDLEWARE end |
.oauth_token ⇒ String
63 64 65 |
# File 'lib/worksnaps/default.rb', line 63 def oauth_token ENV['WORKSNAPS_OAUTH_TOKEN'] end |
.oauth_token_secret ⇒ String
68 69 70 |
# File 'lib/worksnaps/default.rb', line 68 def oauth_token_secret ENV['WORKSNAPS_OAUTH_TOKEN_SECRET'] end |