Scrython/docs/scrython.rulings/Code.md

84 lines
2.2 KiB
Markdown
Raw Normal View History

2018-10-28 05:49:01 +00:00
# **class** `scrython.rulings.Code()`
2018-10-28 05:52:40 +00:00
These docs will likely not be as detailed as the official Scryfall Documentation, and you should reference that for more information.
2018-10-28 05:49:01 +00:00
2018-10-28 05:52:40 +00:00
>In the event that a key isn't found or has been changed, you can access the full JSON output with the `scryfallJson` variable (`Code().scryfallJson`).
2018-10-28 05:53:50 +00:00
2018-10-28 05:49:01 +00:00
## Args
|arg|type|description|
|:---:|:---:|:---:|
2018-10-31 17:06:10 +00:00
|set|string|The 3 letter set code of the card you want rulings for.|
|collector_number|string|The collector number of the card.|
2018-10-28 05:49:01 +00:00
|format|string, optional|Returns data in the specified method. Defaults to JSON.|
2018-10-31 17:06:10 +00:00
|face|string, optional|If you\'re using the `image` format, this will specify if you want the front or back face.|
|version|string, optional|If you\'re using the `image` format, this will specify if you want the small, normal, large, etc version of the image.|
2018-10-28 05:49:01 +00:00
|pretty|string, optional|Returns a prettier version of the json object. Note that this may break functionality with Scrython.|
## Returns
N/A
## Raises
2018-10-28 06:02:37 +00:00
N/A
2018-10-28 05:49:01 +00:00
## Examples
```python
2018-10-31 17:06:10 +00:00
>>> rule = scrython.rulings.Code(code="ddg", collector_number="42")
>>> rule.data_length()
2018-10-28 05:49:01 +00:00
```
## Methods
---
2018-10-31 17:06:10 +00:00
### `data()`
2018-10-28 05:49:01 +00:00
```
2018-10-31 17:06:10 +00:00
The data returned from the query
2018-10-28 05:49:01 +00:00
2018-10-31 17:06:10 +00:00
Acceptable keys:
object (string): The type of object for a given ruling.
source (string): The source of the ruling.
published_at (string): The date when the ruling was published.
comment (string): The effective ruling.
2018-10-28 05:49:01 +00:00
2018-10-31 17:06:10 +00:00
Args:
index (integer, optional): Defaults to None. Access a specific index.
key (string, optional): Defaults to None. Returns the value of the given key. Requires the `index` argument.
2018-10-28 05:49:01 +00:00
Returns:
2018-10-31 17:06:10 +00:00
List: The full list of data.
Dictionary: If given an index
String: If given an index and key.
2018-10-28 05:49:01 +00:00
```
---
2018-10-31 17:06:10 +00:00
### `data_length()`
2018-10-28 05:49:01 +00:00
```
2018-10-31 17:06:10 +00:00
The length of the `data` list.
2018-10-28 05:49:01 +00:00
Returns:
2018-10-31 17:06:10 +00:00
Integer
2018-10-28 05:49:01 +00:00
```
---
2018-10-31 17:06:10 +00:00
### `has_more()`
2018-10-28 05:49:01 +00:00
```
2018-10-31 17:06:10 +00:00
True if there is more than one page of results
2018-10-28 05:49:01 +00:00
Returns:
2018-10-31 17:06:10 +00:00
boolean: True if there are more results
2018-10-28 05:49:01 +00:00
```
---
### `object()`
```
Returns the type of object it is
(card, error, etc)
Returns:
string
```