Code Monkey home page Code Monkey logo

elixir-sdk's Introduction

THIS REPOSITORY HAS BEEN ARCHIVED

Procore

CircleCI

A wrapper around Procore's API. Currently in progress with new resources being added everyday!

Installation

Add the following code to your dependencies in your mix.exs file:

{:procore, "~> 1.0.0"}

Configuration

In one of your configuration files, include your Procore client_id and client_secret key like this:

config :procore,
  client_id: "PROCORE_CLIENT_ID",
  client_secret: "PROCORE_CLIENT_SECRET"
  host: "PROCORE_HOST_URL"
  oauth_url: "#{PROCORE_HOST_URL}/oauth/token",
  http_client: Procore.HttpClient,
  default_version: "v1.0"

default_version sets the default API version to use if none is specified in the client request. Should be either "v1.0" (recommended) or "vapid" (legacy).

Add :procore to your list of applications if using Elixir 1.3 or lower.

defp application do
  [applications: [:procore]]
end

Examples

alias Procore.Resources.Offices

client = Procore.client()

{:ok, response} = client |> Offices.list(%{"company_id" => 1, "api_version" => "v1.1"})

#=> response
%ResponseResult{
  status_code: 200,
  parsed_body: [%{
    "address" => "6309 Carpinteria Ave.",
    "city" => "Carpinteria",
    "country_code" => "US",
    "division" => nil,
    "fax" => "5555555555",
    "id" => 1,
    "name" => "Carpinteria Office",
    "phone" => "5555555555",
    "state_code" => "CA",
    "zip" => "93013"
  }],
  reply: :ok
}

License

The gem is available as open source under the terms of the MIT License.

About Procore

Procore Logo

The Procore Hex package is maintained by Procore Technologies.

Procore - building the software that builds the world.

Learn more about the #1 most widely used construction management software at procore.com

elixir-sdk's People

Contributors

adamwells avatar jgittler avatar mholubowski avatar mikeastock avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

elixir-sdk's Issues

Library Interface Brainstorming

What do you all think of an interface like this?

defmodule Procore.Endpoint do
  def construct(%Procore.Company{id :id}), do: "/vapid/companies/#{id}"
  def construct(%Procore.Company{}), do: "/vapid/companies"
  def construct(%Procore.Inspection{project_id: project_id, id :id}), do: "/vapid/projects/#{project_id}/inspections/#{id}"
end

defmodule Procore.Api do
  def get(struct), do: struct |> Procore.Endpoint.construct() |> OauthClient.get()
  def post(struct, params), do: struct |> Procore.Endpoint.construct() |> OauthClient.post(params)
end

%Procore.ApiResponse{body: body} = Procore.Api.get(%Procore.Company{id: 1})
%Procore.ApiResponse{body: body} = Procore.Api.post(
  %Procore.Inspection{project_id: 2, id: 1},
  %{title: "example title"}
)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.