Module: Freckly

Defined in:
lib/freckly.rb,
lib/freckly/entry.rb,
lib/freckly/project.rb,
lib/freckly/version.rb

Defined Under Namespace

Classes: Entry, Project

Constant Summary collapse

VERSION =
"0.0.8"

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.subdomainObject

Returns the value of attribute subdomain.



18
19
20
# File 'lib/freckly.rb', line 18

def subdomain
  @subdomain
end

.tokenObject

Returns the value of attribute token.



18
19
20
# File 'lib/freckly.rb', line 18

def token
  @token
end

Class Method Details

.authed_connectionObject



26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/freckly.rb', line 26

def authed_connection
  headers = {
    :user_agent => "Freckly",
    "X-FreckleToken" => token
  }
  @connection ||= Faraday::Connection.new(:url => "https://#{subdomain}.letsfreckle.com",
                                          :headers => headers,
                                          :ssl => {:verify => false}) do |builder|
    builder.adapter Faraday.default_adapter
    builder.use Faraday::Response::ParseXml
    builder.use Faraday::Response::Mashify
  end
end

.authed_get(path, options = {}) ⇒ Object



20
21
22
23
24
# File 'lib/freckly.rb', line 20

def authed_get(path, options={})
  authed_connection.get do |request|
    request.url(path, options)
  end.body
end