Sha256: 5bfb945250d826fd9ada402dc8eb4ae1d8496d6b61711e3f3e348f52bbf48dba

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

module NationBuilder
  class Client
    attr_accessor :token, :client_secret, :client_id, :username, :password, :hostname
    
    def initialize(args = {})
      args.each do |key, value|
        self.send("#{key}=".intern, value)
      end
      client = OAuth2::Client.new(client_id, client_secret, :site => "https://#{hostname}", authorize_url: "https://#{hostname}/oauth/authorize", token_url: "https://#{hostname}/oauth/token" )
      self.token = client.password.get_token(username, password)
    end
    
    
    def people
      NationBuilder::People.new(self)
    end
    
    def get(path)
      self.token.get "https://#{hostname}/#{path}"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nation_builder-0.0.1 lib/nation_builder/client.rb