nbwar / onfleet Goto Github PK
View Code? Open in Web Editor NEWOnfleet Ruby Gem
Onfleet Ruby Gem
Hi there. We are trying to create a task with barcodes, and set the barcode scan to block completion. The attributes method is not correctly camelizing the keys for attributes which are not Onfleet (gem) objects, therefore these attributes are ignored by Onfleet.
Example:
Onfleet::Task.create(
destination: '138473',
recipients: ['13294713'],
barcodes: [{ data: 'whatever', block_completion: true }]
)
def attributes
attrs = Hash.new
instance_variables.each do |var|
str = var.to_s.gsub /^@/, ''
if respond_to? "#{str}="
instance_var = instance_variable_get(var)
if klass = Util.object_classes[str]
# Removed for readability
else
# The barcode is not an Onfleet object so the array is simply added to the attrs without
# camelizing the keys
attrs[Util.to_camel_case_lower(str).to_sym] = instance_var
end
end
end
attrs
end
Thanks
http://docs.onfleet.com/docs/tasks#list-tasks
CompleteBeforeBefore and CompleteAfterAfter params do not seem to be supported for Onfleet::Task.list.
edit:
Onfleet::Task.list({completeBeforeBefore: to, completeAfterAfter: from}) returns a list of tasks, but it's the same as if the parameters were not passed. Onfleet::Task.list({worker: 'worker id'}) also returns all tasks, not just the ones by the worker. However Onfleet::Task.list({state: 1}) works.
Seems like the API supports it (http://docs.onfleet.com/docs/teams). Would it be possible to add support?
Thanks!
Is there any reason why this gem depends on rest-client ~> 1.4?
I'm already using rest-client 2.0 and I'm pretty happy with it. I wouldn't want to downgrade.
For better or for worse the Onfleet API expects the skipSMSNotifications
attribute to have all letters in SMS
capitalized. When this gem camelcases attributes it uses the standard ruby approach to acronyms, resulting in skipSmsNotifications
.
Unfortunately, Onfleet is picky and that attribute doesn't work.
The current README.md documentation for skipping phone number validation for a recipient is incorrect. The Onfleet API uses skipPhoneNumberValidation
. https://docs.onfleet.com/reference#create-recipient
In the README.md, it should be skip_phone_number_validation
, not skip_phone_number_verificaton
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.