Sha256: 47eefb96d061713fe5452db36f20ab8592aae34afc47e4de6328780fb7dda104

Contents?: true

Size: 625 Bytes

Versions: 2

Compression:

Stored size: 625 Bytes

Contents

module  ApontadorOauth2
  attr_accessor :options
  class User
    def initialize(options={})
      @options = options.merge!({:url => "https://api.apontador.com.br/v2/"})
    end
    
    def user_information
      response = request({:path => "users/me"}.merge!(@options))
      json(response.body)
    end

    def register_user_in_apontador(options)
      res = request( {:path => "users", :user => options}.merge(@options))
      JSON.parse(res.body) unless res.status == 201
    end
    
    def request(options)
      Request.send(options)
    end
    private
    def json(data)
     JSON.parse(data)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apontador_oauth2-0.1.3 lib/apontador_oauth2/user.rb
apontador_oauth2-0.1.2 lib/apontador_oauth2/user.rb