
Apify Unofficial SDK
Under maintenance
Pricing
Pay per usage

Apify Unofficial SDK
Under maintenance
Apify Unofficial SDK in Other Languanges
0.0 (0)
Pricing
Pay per usage
1
Total users
6
Monthly users
1
Runs succeeded
>99%
Last modified
2 years ago
Apify Ruby SDK Unofficial


About Ruby (programming language)
Ruby is an interpreted, high-level, general-purpose programming language which supports multiple programming paradigms. It was designed with an emphasis on programming productivity and simplicity. In Ruby, everything is an object, including primitive data types. It was developed in the mid-1990s by Yukihiro "Matz" Matsumoto in Japan.
About This Actor
Apify Ruby SDK Unofficial Unstable Unsupported Under Maintenance. Inspired by Apify Python SDK
Disclaimer : This library is community library and not supported by Apify
Included :
- Apify SDK (unofficial)
- Apify Client (unofficial)
Source Code :
Important Notes (for Ruby beginner like me) :
- On ruby all evaluated to
true
except for:false
andnil
. - Function will return value from last expression.
Developer Notes
- Some method is conflicting with Ruby internal method such as:
.initialize
,.exit
,.fail
, etc. Renamed to:.initialize_
,.exit_
,.fail_
etc.
Installation
$git clone https://github.com/JupriGH/apify-ruby-sdk.git
# import inside scriptrequire_relative './apify-ruby-sdk/lib/apify_sdk'
Enable Logging
logger = Apify::Log# level: INFO | WARN | ERROR | FATAL | UNKNOWNlogger.level = Logger::DEBUG# Formatterlogger.formatter = Apify::ActorLogFormatter.new
Basic Usage
# SYNC Mode# won't be able to receive platform events (aborting, migration, etc.)# for testing on local development (eg: IRB)Apify::Actor.main(<callable>)# ASYNC Mode# use on apify platform to receive platform eventsAsync doApify::Actor.main(<callable>)end
Example #1
Apify::Actor.main( lambda { |actor|input = actor.get_input0 # optional exit code})
or
actor = Apify::Actoractor.main( lambda {input = actor.get_input0 # optional exit code})
Example #2
def main(actor)input = actor.get_inputendApify::Actor.main( method(:main) )
Using "with" emulator
Use with
function to emulate Python context manager
# SYNC Modewith Apify::Actor do |actor|input = actor.get_inputend# ASYNC ModeAsync dowith Apify::Actor do |actor|input = actor.get_inputendend
do ... end
can be replaced with { ... }
Async {with Apify::Actor { |actor|input = actor.get_input}}