Sha256: 517ea64361468ae62ef55fd61527669ea688489a5f20bd96b3f15b5867f4a787

Contents?: true

Size: 951 Bytes

Versions: 4

Compression:

Stored size: 951 Bytes

Contents

require "spyke"
require "trello_flow/api/json_parser"
require "trello_flow/api/error_handler"

module TrelloFlow
  module Api
    class Base < Spyke::Base
      require "trello_flow/api/board"
      require "trello_flow/api/card"
      require "trello_flow/api/label"
      require "trello_flow/api/list"
      require "trello_flow/api/member"

      include_root_in_json false
      cattr_accessor :token

      def self.configure(key:, token:)
        self.connection = Faraday.new(url: "https://api.trello.com/1", params: { key: key, token: token }) do |c|
          c.request  :json
          c.use JSONParser
          c.use ErrorHandler
          c.adapter  Faraday.default_adapter

          # For trello api logging
          # require "faraday/conductivity"
          # c.use       Faraday::Conductivity::ExtendedLogging
        end
        self.token = token
      end

      def position
        self[:pos].to_f
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trello_flow-3.8.0 lib/trello_flow/api/base.rb
trello_flow-3.7.1 lib/trello_flow/api/base.rb
trello_flow-3.7.0 lib/trello_flow/api/base.rb
trello_flow-3.6.0 lib/trello_flow/api/base.rb