Sha256: d456b817e113125acf060f0b7262487f9737cd804c2786e5a4af144b1cbb862d

Contents?: true

Size: 1.1 KB

Versions: 3

Compression:

Stored size: 1.1 KB

Contents

require 'active_model'
require 'builder'
require 'logger'
require 'httparty'
require 'json'

module MyMoip
  class << self
    attr_accessor :production_key, :production_token,
                  :sandbox_key, :sandbox_token,
                  :environment, :logger, :default_referer_url

    def api_url
      if environment == "sandbox"
        "https://desenvolvedor.moip.com.br/sandbox"
      else
        "https://www.moip.com.br"
      end
    end

    def key=(value)
      warn "[DEPRECATION] `key=` is deprecated. Please use `sandbox_key` or `production_key` instead."
      @production_key = @sandbox_key = value
    end

    def token=(value)
      warn "[DEPRECATION] `token=` is deprecated. Please use `sandbox_token` or `production_token` instead."
      @production_token = @sandbox_token = value
    end

    def key
      send(:"#{environment}_key")
    end

    def token
      send(:"#{environment}_token")
    end
  end
end

$LOAD_PATH << "./lib/mymoip"

files = Dir[File.dirname(__FILE__) + "/mymoip/*.rb"]
files.each { |f| require f }

MyMoip.environment = "sandbox"
MyMoip.logger = Logger.new(STDOUT)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
mymoip-0.6.0 lib/mymoip.rb
mymoip-0.5.0 lib/mymoip.rb
mymoip-0.4.1 lib/mymoip.rb