Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

My-first-api-matic

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

My-first-api-matic

  • 1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Getting Started with Youtube

Getting Started

Install the Package

Install the gem from the command line:

gem install My-first-api-matic -v 1.0

Or add the gem to your Gemfile and run bundle:

gem 'My-first-api-matic', '1.0'

For additional gem details, see the RubyGems page for the My-first-api-matic gem.

Initialize the API Client

The following parameters are configurable for the API Client:

ParameterTypeDescription
timeoutFloatThe value to use for connection timeout.
Default: 60
max_retriesIntegerThe number of times to retry an endpoint call if it fails.
Default: 0
retry_intervalFloatPause in seconds between retries.
Default: 1
backoff_factorFloatThe amount to multiply each successive retry's interval amount by in order to provide backoff.
Default: 2
retry_statusesArrayA list of HTTP statuses to retry.
Default: [408, 413, 429, 500, 502, 503, 504, 521, 522, 524]
retry_methodsArrayA list of HTTP methods to retry.
Default: %i[get put]

The API client can be initialized as follows:

client = Youtube::Client.new(
)

API Errors

Here is the list of errors that the API might throw.

HTTP Status CodeError DescriptionException Class
401dfgdfgdfgdfgdsfgProblemDetailsException

Client Class Documentation

Youtube Client

The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK.

Controllers

NameDescription
apiGets APIController

API Reference

List of APIs

  • API

API

Overview
Get instance

An instance of the APIController class can be accessed from the API Client.

client_controller = client.client
Get Forcast

get list of 5 random forcasts

:information_source: Note This endpoint does not require authentication.

def get_forcast(param: 'String.Empty')
Parameters
ParameterTypeTagsDescription
paramStringQuery, Optionaldefault string parameter
Default: 'String.Empty'
Server

Server::DEFAULT

Response Type

Mixed

Example Usage
param = 'my value for error'
result = client_controller.get_forcast(param: param)
Example Response
[
  {
    "date": "2021-05-27T10:33:06.7728939+05:00",
    "temperatureC": -7,
    "temperatureF": 20,
    "summary": "Scorching"
  },
  {
    "date": "2021-05-28T10:33:06.7729006+05:00",
    "temperatureC": 6,
    "temperatureF": 42,
    "summary": "Bracing"
  }
]
Errors
HTTP Status CodeError DescriptionException Class
400Test error messageProblemDetailsException
404not foundAPIException

Model Reference

Structures

Weather Forecast
Class Name

WeatherForecast

Fields
NameTypeTagsDescription
dateDateTimeRequiredThe time when forecast was taken
temperature_cIntegerRequiredthe value of temperature in Centigrade
temperature_fIntegerRequired, Constantthe value of temperature in Fahrenheit
summaryStringRequired, Constant-
Example (as JSON)
{
  "date": "2021-05-27T10:33:06.7728939+05:00",
  "temperatureC": -7,
  "temperatureF": 20,
  "summary": "Scorching"
}
Weather Forcase Json Imported
Class Name

WeatherForcaseJsonImported

Fields
NameTypeTagsDescription
dateStringRequired-
temperature_cIntegerRequired-
temperature_fIntegerRequired-
summaryStringRequired-
Example (as JSON)
{
  "date": "2021-05-27T10:33:06.7728939+05:00",
  "temperatureC": -7,
  "temperatureF": 20,
  "summary": "Scorching"
}
Field Parameter Validator
Class Name

FieldParameterValidator

Fields
NameTypeTagsDescription
precisionFloatRequiredConstraints: > 0, < 600, Multiple Of: 10, Total Digits: 1000, Fraction Digits: 2
stringArray<String>Optional, ConstantConstraints: Minimum Items: 5, Maximum Items: 200, Minimum Length: 3, Maximum Length: 10, Pattern: /^[A-Z]+$/i
unix_format_date_timeDateTimeRequired-
objectObjectRequired-
int_64LongRequiredConstraints: > 23, < 23, Multiple Of: 3, Total Digits: 23, Fraction Digits: 23, Pattern: 2
Example (as JSON)
{
  "Precision": 229.08,
  "UnixFormatDateTime": 1480809600,
  "Object": {
    "key1": "val1",
    "key2": "val2"
  },
  "Int64": 10
}

Enumerations

Test Enum

This is the test description of enum00

Class Name

TestEnum

Fields
NameDescription
FIRSTFILEDTest description of first filed
SECONDFIELDTest description of Second filed
THIRD_VALUE

Exceptions

Problem Details
Class Name

ProblemDetailsException

Fields
NameTypeTagsDescription
typeStringRequired, Constant-
titleStringRequired, Constant-
statusIntegerRequired, Constant-
trace_idStringRequired, Constant-
Example (as JSON)
{
  "type": "https://tools.ietf.org/html/rfc7231#section-6.5.1",
  "title": "Bad Request",
  "status": 400,
  "traceId": "00-3dd0a6221d0ccd48ad5eb89a9cf3df71-91763b2e58fa4742-00"
}

Utility Classes Documentation

ApiHelper Class

API utility class.

Methods

NameReturn TypeDescription
json_deserializeHashDeserializes a JSON string to a Ruby Hash.
rfc3339DateTimeSafely converts a string into an RFC3339 DateTime object.

Common Code Documentation

HttpResponse

Http response received.

Properties
NameTypeDescription
status_codeIntegerThe status code returned by the server.
reason_phraseStringThe reason phrase returned by the server.
headersHashResponse headers.
raw_bodyStringResponse body.
requestHttpRequestThe request that resulted in this response.

HttpRequest

Represents a single Http Request.

Properties
NameTypeTagDescription
http_methodHttpMethodEnumThe HTTP method of the request.
query_urlStringThe endpoint URL for the API request.
headersHashOptionalRequest headers.
parametersHashOptionalRequest body.

FAQs

Package last updated on 14 Jun 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc