versafleet 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2872dea00a6a74e0da415d8aff37a0e9273664d2ceb5769e697879ac7d5f13d3
4
+ data.tar.gz: 5101033d3ed26baff22805df056213059a2d1639b98608773e732ed885ceea45
5
+ SHA512:
6
+ metadata.gz: bc310498781806260dac85344782a306a0f4677f38dc686b7b887a02c00f6135c2249cf8aa688730b02870113bba01d4626c5e435f950b4cbc6dbad58ed41fb5
7
+ data.tar.gz: 3228a237fec17275742a3720cb7c48d61b9c1ac0a0fe478f272aacd88eaa82bd997aa6837a7b81bf4c2ffb126ebbd82b86ca177cf9ffb8ab837b1125a91fcf4c
@@ -0,0 +1,41 @@
1
+ name: Build + Release
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - "v*.*.*"
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-20.04
11
+
12
+ strategy:
13
+ matrix:
14
+ ruby: ["2.5", "2.6", "2.7", "3.0"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v2
18
+
19
+ - name: Set up Ruby
20
+ uses: ruby/setup-ruby@v1
21
+ with:
22
+ ruby-version: ${{ matrix.ruby }}
23
+ bundler-cache: true
24
+
25
+ - name: StandardRb check
26
+ run: bundle exec standardrb
27
+
28
+ - name: Run tests
29
+ run: |
30
+ bundle exec rake test
31
+
32
+ - name: Publish to RubyGems
33
+ run: |
34
+ mkdir -p $HOME/.gem
35
+ touch $HOME/.gem/credentials
36
+ chmod 0600 $HOME/.gem/credentials
37
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
38
+ gem build *.gemspec
39
+ gem push *.gem
40
+ env:
41
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,33 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ branches:
9
+ - "*"
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-20.04
14
+
15
+ strategy:
16
+ matrix:
17
+ ruby: ["2.5", "2.6", "2.7", "3.0"]
18
+
19
+ steps:
20
+ - uses: actions/checkout@v2
21
+
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: ${{ matrix.ruby }}
26
+ bundler-cache: true
27
+
28
+ - name: StandardRb check
29
+ run: bundle exec standardrb
30
+
31
+ - name: Run tests
32
+ run: |
33
+ bundle exec rake test
data/.gitignore ADDED
@@ -0,0 +1,10 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
9
+ /versafleet-*.gem
10
+ /Gemfile.lock
@@ -0,0 +1,84 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
6
+
7
+ We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
8
+
9
+ ## Our Standards
10
+
11
+ Examples of behavior that contributes to a positive environment for our community include:
12
+
13
+ * Demonstrating empathy and kindness toward other people
14
+ * Being respectful of differing opinions, viewpoints, and experiences
15
+ * Giving and gracefully accepting constructive feedback
16
+ * Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
17
+ * Focusing on what is best not just for us as individuals, but for the overall community
18
+
19
+ Examples of unacceptable behavior include:
20
+
21
+ * The use of sexualized language or imagery, and sexual attention or
22
+ advances of any kind
23
+ * Trolling, insulting or derogatory comments, and personal or political attacks
24
+ * Public or private harassment
25
+ * Publishing others' private information, such as a physical or email
26
+ address, without their explicit permission
27
+ * Other conduct which could reasonably be considered inappropriate in a
28
+ professional setting
29
+
30
+ ## Enforcement Responsibilities
31
+
32
+ Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.
33
+
34
+ Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.
35
+
36
+ ## Scope
37
+
38
+ This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.
39
+
40
+ ## Enforcement
41
+
42
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at mafulprayoga@gmail.com. All complaints will be reviewed and investigated promptly and fairly.
43
+
44
+ All community leaders are obligated to respect the privacy and security of the reporter of any incident.
45
+
46
+ ## Enforcement Guidelines
47
+
48
+ Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:
49
+
50
+ ### 1. Correction
51
+
52
+ **Community Impact**: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.
53
+
54
+ **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.
55
+
56
+ ### 2. Warning
57
+
58
+ **Community Impact**: A violation through a single incident or series of actions.
59
+
60
+ **Consequence**: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.
61
+
62
+ ### 3. Temporary Ban
63
+
64
+ **Community Impact**: A serious violation of community standards, including sustained inappropriate behavior.
65
+
66
+ **Consequence**: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.
67
+
68
+ ### 4. Permanent Ban
69
+
70
+ **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.
71
+
72
+ **Consequence**: A permanent ban from any sort of public interaction within the community.
73
+
74
+ ## Attribution
75
+
76
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 2.0,
77
+ available at https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
78
+
79
+ Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).
80
+
81
+ [homepage]: https://www.contributor-covenant.org
82
+
83
+ For answers to common questions about this code of conduct, see the FAQ at
84
+ https://www.contributor-covenant.org/faq. Translations are available at https://www.contributor-covenant.org/translations.
data/Gemfile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in versafleet.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "minitest", "~> 5.0"
11
+
12
+ gem "standard", "~> 1.3"
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Maful Prayoga A
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,106 @@
1
+ # VersaFleet API
2
+
3
+ You'll need a VersaFleet account to use the API, if you don't have one visit the [VersaFleet](https://versafleet.co) website for more information.
4
+
5
+ [![Build status](https://github.com/maful/versafleet-ruby/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/maful/versafleet-ruby/actions/workflows/test.yml) [![Gem Version](https://badge.fury.io/rb/versafleet.svg)](https://badge.fury.io/rb/versafleet)
6
+
7
+ ## Installation
8
+
9
+ Add `versafleet` to your application's Gemfile:
10
+
11
+ ```bash
12
+ bundle add versafleet
13
+
14
+ # OR in the Gemfile
15
+ gem "versafleet"
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ To access the API, you'll need to create a `Versafleet::Client` and pass in your API Key and Secret Key. See [How to obtain API keys](https://versafleet.docs.apiary.io/#introduction/to-obtain-api-keys-(please-keep-them-safe!))
21
+
22
+ ```ruby
23
+ client = Versafleet::Client.new(client_id: ENV["CLIENT_ID"], client_secret: ENV["CLIENT_SECRET"])
24
+ ```
25
+
26
+ The client then gives you access to each of resources.
27
+
28
+ ## Resources
29
+
30
+ ### Jobs
31
+
32
+ ```ruby
33
+ # list jobs with per page is 20
34
+ client.jobs.list(per_page: 20)
35
+ # view the a job details
36
+ client.jobs.retrieve(job_id: "id")
37
+ # create a job
38
+ client.jobs.create(job: {})
39
+ # update job
40
+ client.jobs.update(job_id: "id", job: {})
41
+ # cancel the job
42
+ client.jobs.cancel(job_id: "id")
43
+ # list tasks of job
44
+ client.jobs.list_tasks(job_id: "id")
45
+ ```
46
+
47
+ ### Tasks
48
+
49
+ ```ruby
50
+ # list all tasks
51
+ client.tasks.list
52
+ # list all tasks by state
53
+ client.tasks.list_by_state(state: state)
54
+ # get the task details
55
+ client.tasks.retrieve(task_id: task_id)
56
+ # get the task by tracking id
57
+ client.tasks.retrieve_by_tracking_id(tracking_id: tracking_id)
58
+ # update the task
59
+ client.tasks.update(task_id: task_id, task_attributes: {})
60
+ # add a task to job
61
+ client.tasks.create(task_attributes: {})
62
+ # assign task to driver
63
+ client.tasks.assign(task_id: task_id, task: {driver_id: driver_id, vehicle_id: vehicle_id, remarks: "Notes"})
64
+ # assign multiple tasks to driver
65
+ client.tasks.assign_multiple(task: {ids: [], driver_id: driver_id, vehicle_id: vehicle_id, remarks: "Notes")
66
+ # unassign task
67
+ client.tasks.unassign(task_id: task_id)
68
+ # unassign multiple tasks
69
+ client.tasks.unassign_multiple(task: {ids: []})
70
+ # cancel the task
71
+ client.tasks.cancel(task_id: task_id)
72
+ # complete the task
73
+ client.tasks.complete(task_id: task_id)
74
+ # incomplete the task
75
+ client.tasks.incomplete(task_id: task_id)
76
+ # set state to the task
77
+ client.tasks.set_state(task_id: task_id, to_state: to_state)
78
+ # archive the task
79
+ client.tasks.archive(task_id: task_id)
80
+ # unarchive the task
81
+ client.tasks.unarchive(task_id: task_id)
82
+ # allocate task to transporter
83
+ client.tasks.allocate(task_id: task_id, sub_account_id: sub_account_id)
84
+ # get the task completion histories
85
+ client.tasks.completion_histories(task_id: task_id)
86
+ # get the base task completion histories
87
+ client.tasks.base_completion_histories(task_id: task_id)
88
+ ```
89
+
90
+ ## TO DO
91
+
92
+ - [ ] Add API Documentation
93
+ - [ ] Add Docker support
94
+ - [ ] Support to All VersaFleet API endpoints.
95
+
96
+ ## 🙏 Contributing
97
+
98
+ This project uses Standard for formatting Ruby code. Please make sure to run standardrb before submitting pull requests. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/maful/versafleet-ruby/blob/master/CODE_OF_CONDUCT.md).
99
+
100
+ ## Code of Conduct
101
+
102
+ Everyone interacting in the VersaFleet project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/maful/versafleet-ruby/blob/master/CODE_OF_CONDUCT.md).
103
+
104
+ ## License
105
+
106
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rake/testtask"
5
+
6
+ Rake::TestTask.new(:test) do |t|
7
+ t.libs << "test"
8
+ t.libs << "lib"
9
+ t.test_files = FileList["test/**/*_test.rb"]
10
+ end
11
+
12
+ task default: :test
data/bin/console ADDED
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "versafleet"
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require "irb"
15
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,35 @@
1
+ module Versafleet
2
+ class Client
3
+ BASE_URL = "https://api.versafleet.co/api"
4
+
5
+ attr_reader :client_id, :client_secret
6
+
7
+ def initialize(client_id:, client_secret:)
8
+ @client_id = client_id
9
+ @client_secret = client_secret
10
+ end
11
+
12
+ def jobs
13
+ JobsResource.new(self)
14
+ end
15
+
16
+ def tasks
17
+ TasksResource.new(self)
18
+ end
19
+
20
+ def connection
21
+ @connection ||= Faraday.new(params: default_params) do |conn|
22
+ conn.url_prefix = BASE_URL
23
+ conn.request :json
24
+ conn.response :json, content_type: "application/json"
25
+ conn.adapter Faraday.default_adapter
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ def default_params
32
+ {client_id: client_id, client_secret: client_secret}
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,22 @@
1
+ module Versafleet
2
+ class Collection
3
+ attr_reader :data, :page, :per_page, :total
4
+
5
+ def self.from_response(response, key:, type:)
6
+ body = response.body
7
+ new(
8
+ data: body[key].map { |attrs| type.new(attrs) },
9
+ page: body.dig("meta", "page"),
10
+ per_page: body.dig("meta", "per_page"),
11
+ total: body.dig("meta", "total")
12
+ )
13
+ end
14
+
15
+ def initialize(data:, page:, per_page:, total:)
16
+ @data = data
17
+ @page = page
18
+ @per_page = per_page
19
+ @total = total
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,4 @@
1
+ module Versafleet
2
+ class Error < StandardError
3
+ end
4
+ end
@@ -0,0 +1,19 @@
1
+ require "ostruct"
2
+
3
+ module Versafleet
4
+ class Object < OpenStruct
5
+ def initialize(attributes)
6
+ super to_ostruct(attributes)
7
+ end
8
+
9
+ def to_ostruct(obj)
10
+ if obj.is_a?(Hash)
11
+ OpenStruct.new(obj.map { |key, val| [key, to_ostruct(val)] }.to_h)
12
+ elsif obj.is_a?(Array)
13
+ obj.map { |o| to_ostruct(o) }
14
+ else
15
+ obj
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,4 @@
1
+ module Versafleet
2
+ class Job < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Versafleet
2
+ class Task < Object
3
+ end
4
+ end
@@ -0,0 +1,34 @@
1
+ module Versafleet
2
+ class Resource
3
+ attr_reader :client
4
+
5
+ def initialize(client)
6
+ @client = client
7
+ end
8
+
9
+ private
10
+
11
+ def get_request(url, params: {}, headers: {})
12
+ handle_response client.connection.get(url, params, headers)
13
+ end
14
+
15
+ def post_request(url, body:, headers: {})
16
+ handle_response client.connection.post(url, body, headers)
17
+ end
18
+
19
+ def put_request(url, body:, headers: {})
20
+ handle_response client.connection.put(url, body, headers)
21
+ end
22
+
23
+ def handle_response(response)
24
+ case response.status
25
+ when 404
26
+ raise Error, "No results were found for your request. #{response.body["message"]}"
27
+ when 500
28
+ raise Error, "We were unable to perform the request due to server-side problems. #{response.body["message"]}"
29
+ end
30
+
31
+ response
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,29 @@
1
+ module Versafleet
2
+ class JobsResource < Resource
3
+ def list(**params)
4
+ response = get_request("v2/jobs", params: params)
5
+ Collection.from_response(response, key: "jobs", type: Job)
6
+ end
7
+
8
+ def create(**attributes)
9
+ Job.new post_request("v2/jobs", body: attributes).body.dig("job")
10
+ end
11
+
12
+ def update(job_id:, **attributes)
13
+ Job.new put_request("v2/jobs/#{job_id}", body: attributes).body.dig("job")
14
+ end
15
+
16
+ def retrieve(job_id:)
17
+ Job.new get_request("v2/jobs/#{job_id}").body.dig("job")
18
+ end
19
+
20
+ def cancel(job_id:)
21
+ Job.new put_request("v2/jobs/#{job_id}/cancel", body: {}).body
22
+ end
23
+
24
+ def list_tasks(job_id:)
25
+ response = get_request("v2/jobs/#{job_id}/tasks")
26
+ Collection.from_response(response, key: "tasks", type: Task)
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,89 @@
1
+ module Versafleet
2
+ class TasksResource < Resource
3
+ def list(**params)
4
+ response = get_request("tasks", params: params)
5
+ Collection.from_response(response, key: "tasks", type: Task)
6
+ end
7
+
8
+ def list_by_state(**params)
9
+ response = get_request("tasks/by_state", params: params)
10
+ Collection.from_response(response, key: "tasks", type: Task)
11
+ end
12
+
13
+ def retrieve(task_id:)
14
+ Task.new get_request("tasks/#{task_id}").body.dig("task")
15
+ end
16
+
17
+ def retrieve_by_tracking_id(tracking_id:)
18
+ Task.new post_request("tasks/#{tracking_id}/track", body: {}).body.dig("task")
19
+ end
20
+
21
+ def update(task_id:, task_attributes:)
22
+ payload = {task_attributes: task_attributes}
23
+ Task.new put_request("tasks/#{task_id}", body: payload).body.dig("task")
24
+ end
25
+
26
+ # TODO: Add support for allocate_id
27
+ def create(task_attributes:)
28
+ payload = {task_attributes: task_attributes}
29
+ Task.new post_request("tasks", body: payload).body.dig("task")
30
+ end
31
+
32
+ def assign(task_id:, task:)
33
+ payload = {task: task}
34
+ Task.new put_request("tasks/#{task_id}/assign", body: payload).body.dig("task")
35
+ end
36
+
37
+ def assign_multiple(task:)
38
+ payload = {task: task}
39
+ put_request("tasks/assign", body: payload).body
40
+ end
41
+
42
+ def unassign(task_id:)
43
+ Task.new put_request("tasks/#{task_id}/unassign", body: {}).body.dig("task")
44
+ end
45
+
46
+ def unassign_multiple(task:)
47
+ payload = {task: task}
48
+ put_request("tasks/unassign", body: payload).body
49
+ end
50
+
51
+ def cancel(task_id:)
52
+ put_request("tasks/#{task_id}/cancel", body: {}).body
53
+ end
54
+
55
+ def complete(task_id:)
56
+ put_request("tasks/#{task_id}/set_successful", body: {}).body
57
+ end
58
+
59
+ def incomplete(task_id:)
60
+ put_request("tasks/#{task_id}/set_failed", body: {}).body
61
+ end
62
+
63
+ def set_state(task_id:, to_state:)
64
+ payload = {to_state: to_state}
65
+ put_request("tasks/#{task_id}/state", body: payload).body
66
+ end
67
+
68
+ def archive(task_id:)
69
+ Task.new put_request("tasks/#{task_id}/archive", body: {}).body.dig("task")
70
+ end
71
+
72
+ def unarchive(task_id:)
73
+ Task.new put_request("tasks/#{task_id}/unarchive", body: {}).body.dig("task")
74
+ end
75
+
76
+ def completion_histories(task_id:)
77
+ Task.new get_request("tasks/#{task_id}/task_completion_histories").body
78
+ end
79
+
80
+ def base_completion_histories(task_id:)
81
+ Task.new get_request("tasks/#{task_id}/base_task_completion_histories").body
82
+ end
83
+
84
+ def allocate(task_id:, sub_account_id:)
85
+ payload = {task: {allocatee_id: sub_account_id}}
86
+ Task.new put_request("tasks/#{task_id}/allocate", body: payload).body.dig("task")
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Versafleet
4
+ VERSION = "0.1.0"
5
+ end
data/lib/versafleet.rb ADDED
@@ -0,0 +1,19 @@
1
+ require "faraday"
2
+ require "faraday_middleware"
3
+ require "versafleet/version"
4
+
5
+ module Versafleet
6
+ autoload :Client, "versafleet/client"
7
+ autoload :Resource, "versafleet/resource"
8
+ autoload :Object, "versafleet/object"
9
+ autoload :Error, "versafleet/error"
10
+ autoload :Collection, "versafleet/collection"
11
+
12
+ # Resources (like high level API endpoints)
13
+ autoload :JobsResource, "versafleet/resources/jobs"
14
+ autoload :TasksResource, "versafleet/resources/tasks"
15
+
16
+ # Classes used to return a nicer object wrapping the response data
17
+ autoload :Job, "versafleet/objects/job"
18
+ autoload :Task, "versafleet/objects/task"
19
+ end
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "lib/versafleet/version"
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = "versafleet"
7
+ spec.version = Versafleet::VERSION
8
+ spec.authors = ["Maful Prayoga A"]
9
+ spec.email = ["mafulprayoga@gmail.com"]
10
+
11
+ spec.summary = "Ruby bindings for the VersaFleet API"
12
+ spec.homepage = "https://versafleet.co"
13
+ spec.license = "MIT"
14
+ spec.required_ruby_version = ">= 2.4.0"
15
+
16
+ spec.metadata["homepage_uri"] = spec.homepage
17
+ spec.metadata["bug_tracker_uri"] = "https://github.com/maful/versafleet-ruby/issues"
18
+ spec.metadata["source_code_uri"] = "https://github.com/maful/versafleet-ruby"
19
+ spec.metadata["github_repo"] = "https://github.com/maful/versafleet-ruby"
20
+ # spec.metadata["changelog_uri"] = "https://github.com/maful/versafleet-ruby/blob/main/CHANGELOG.md"
21
+ # spec.metadata["documentation_uri"] = "TODO: Add documentation"
22
+
23
+ # Specify which files should be added to the gem when it is released.
24
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
25
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
26
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
27
+ end
28
+ spec.bindir = "exe"
29
+ spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
30
+ spec.require_paths = ["lib"]
31
+
32
+ spec.add_dependency "faraday", "~> 1.7"
33
+ spec.add_dependency "faraday_middleware", "~> 1.1"
34
+ end
metadata ADDED
@@ -0,0 +1,97 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: versafleet
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Maful Prayoga A
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2021-09-13 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ description:
42
+ email:
43
+ - mafulprayoga@gmail.com
44
+ executables: []
45
+ extensions: []
46
+ extra_rdoc_files: []
47
+ files:
48
+ - ".github/workflows/release.yml"
49
+ - ".github/workflows/test.yml"
50
+ - ".gitignore"
51
+ - CODE_OF_CONDUCT.md
52
+ - Gemfile
53
+ - LICENSE.txt
54
+ - README.md
55
+ - Rakefile
56
+ - bin/console
57
+ - bin/setup
58
+ - lib/versafleet.rb
59
+ - lib/versafleet/client.rb
60
+ - lib/versafleet/collection.rb
61
+ - lib/versafleet/error.rb
62
+ - lib/versafleet/object.rb
63
+ - lib/versafleet/objects/job.rb
64
+ - lib/versafleet/objects/task.rb
65
+ - lib/versafleet/resource.rb
66
+ - lib/versafleet/resources/jobs.rb
67
+ - lib/versafleet/resources/tasks.rb
68
+ - lib/versafleet/version.rb
69
+ - versafleet.gemspec
70
+ homepage: https://versafleet.co
71
+ licenses:
72
+ - MIT
73
+ metadata:
74
+ homepage_uri: https://versafleet.co
75
+ bug_tracker_uri: https://github.com/maful/versafleet-ruby/issues
76
+ source_code_uri: https://github.com/maful/versafleet-ruby
77
+ github_repo: https://github.com/maful/versafleet-ruby
78
+ post_install_message:
79
+ rdoc_options: []
80
+ require_paths:
81
+ - lib
82
+ required_ruby_version: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 2.4.0
87
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: '0'
92
+ requirements: []
93
+ rubygems_version: 3.2.22
94
+ signing_key:
95
+ specification_version: 4
96
+ summary: Ruby bindings for the VersaFleet API
97
+ test_files: []