Skip to content

Commit de40af8

Browse files
committed
- Updated package info
1 parent 356c7f3 commit de40af8

File tree

6 files changed

+31
-15
lines changed

6 files changed

+31
-15
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## [v0.3.2](https://github.com/Herohtar/wordnik-dart/releases/tag/v0.3.2) - 2018-07-14
2+
3+
* Improved example code
4+
* Added [`credentials_helper`](https://pub.dartlang.org/packages/credentials_helper) to work with the API key more easily
5+
16
## [v0.3.1](https://github.com/Herohtar/wordnik-dart/releases/tag/v0.3.1) - 2018-07-11
27

38
* Fixed return type for `getEtymologies()`

example/lib/example.dart

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
// These aren't necessary for standard operation of the API;
22
// they are only required for the API key import and some of the example code
33
import 'dart:math';
4-
import 'package:credentials/credentials.dart';
4+
import 'package:credentials_helper/credentials_helper.dart';
55

66
// Required imports
77
import 'package:wordnik/wordnik.dart';
88

99
void main() async {
10+
Random random = Random();
11+
1012
// This isn't required, but you'll need to provide the API key in some way
1113
Credentials credentials = Credentials.fromFile('credentials.json');
1214

@@ -42,7 +44,7 @@ void main() async {
4244
print('The first one is: "${examples.examples.first.text}"\n');
4345

4446
FrequencySummary frequencySummary = await wordnik.getWordFrequency(exampleWord.word);
45-
Frequency frequency = frequencySummary.frequency[Random().nextInt(frequencySummary.frequency.length)];
47+
Frequency frequency = frequencySummary.frequency[random.nextInt(frequencySummary.frequency.length)];
4648
print('${frequency.count} occurances from the year ${frequency.year}\n');
4749

4850
List<Syllable> syllables = await wordnik.getHyphenation(exampleWord.word);
@@ -52,7 +54,7 @@ void main() async {
5254
exampleWord.word,
5355
limit: 10
5456
);
55-
Bigram bigram = bigrams[Random().nextInt(bigrams.length)];
57+
Bigram bigram = bigrams[random.nextInt(bigrams.length)];
5658
print('You might say "${bigram.gram1} ${bigram.gram2}".\n');
5759

5860
List<TextPron> textProns = await wordnik.getTextPronunciations(exampleWord.word);
@@ -65,8 +67,8 @@ void main() async {
6567
);
6668
Related synonyms = relatedWords.firstWhere((word) => word.relationshipType == 'synonym');
6769
Related rhymes = relatedWords.firstWhere((word) => word.relationshipType == 'rhyme');
68-
print('${synonyms.words.length} synonyms found, including "${synonyms.words[Random().nextInt(synonyms.words.length)]}".\n');
69-
print('${rhymes.words.length} rhymes found, including "${rhymes.words[Random().nextInt(rhymes.words.length)]}".\n');
70+
print('${synonyms.words.length} synonyms found, including "${synonyms.words[random.nextInt(synonyms.words.length)]}".\n');
71+
print('${rhymes.words.length} rhymes found, including "${rhymes.words[random.nextInt(rhymes.words.length)]}".\n');
7072

7173
Example example = await wordnik.getTopExample(exampleWord.word);
7274
print('The top example is: "${example.text}" from ${example.title}.\n');
@@ -128,7 +130,7 @@ void main() async {
128130

129131
List<StringValue> wordsToDelete = List<StringValue>()
130132
..add(StringValue(word: exampleWord.word))
131-
..add(StringValue(word: randomAdjectives[Random().nextInt(randomAdjectives.length)].word));
133+
..add(StringValue(word: randomAdjectives[random.nextInt(randomAdjectives.length)].word));
132134
await wordnik.deleteWordsFromWordList(
133135
authToken.token,
134136
createdWordList.permalink,
@@ -137,7 +139,7 @@ void main() async {
137139
print('Deleted ${wordsToDelete.length} words from "${createdWordList.name}".\n');
138140

139141
WordList modifiedWordList = createdWordList
140-
..description = 'I feel like a ${randomAdjectives[Random().nextInt(randomAdjectives.length)].word} ${randomNoun.word} ${exampleWord.word}.';
142+
..description = 'I feel like a ${randomAdjectives[random.nextInt(randomAdjectives.length)].word} ${randomNoun.word} ${exampleWord.word}.';
141143
await wordnik.updateWordList(
142144
authToken.token,
143145
modifiedWordList.permalink,

example/pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ environment:
55
sdk: ">=2.0.0-dev.58.0 <2.0.0"
66

77
dependencies:
8-
wordnik: ^0.2.0
8+
wordnik: ^0.3.2
99

1010
# Used for the example, but not required for the API
11-
credentials:
12-
path: ../../credentials
11+
credentials_helper: ^1.0.1

lib/wordnik.dart

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,18 @@ class Wordnik {
7777

7878
Wordnik(this.apiKey);
7979

80-
Future<String> _queryApi(String resource, String format, String operation, {String extraTerm, Map<String, String> queryParameters, ApiMethods method = ApiMethods.get, dynamic body, String authToken}) async {
80+
Future<String> _queryApi(
81+
String resource,
82+
String format,
83+
String operation,
84+
{
85+
String extraTerm,
86+
Map<String, String> queryParameters,
87+
ApiMethods method = ApiMethods.get,
88+
dynamic body,
89+
String authToken
90+
}
91+
) async {
8192
List<String> segments = [
8293
'v$_apiVersion',
8394
'$resource.$format',

pubspec.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: wordnik
22
description: Wordnik API for Dart
3-
version: 0.3.1
3+
version: 0.3.2
44
author: "Herohtar <[email protected]>"
55
homepage: https://github.com/herohtar/wordnik-dart
66

@@ -13,8 +13,7 @@ dev_dependencies:
1313
test: ^1.2.0
1414
build_runner: ^0.9.1
1515
json_serializable: ^0.5.8
16-
credentials:
17-
path: ../credentials
16+
credentials_helper: ^1.0.1
1817

1918
environment:
2019
sdk: ">=2.0.0-dev.58.0 <2.0.0"

test/wordnik_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import 'package:test/test.dart';
22
import 'package:wordnik/wordnik.dart';
3-
import 'package:credentials/credentials.dart';
3+
import 'package:credentials_helper/credentials_helper.dart';
44

55
void main() {
66
Credentials credentials;

0 commit comments

Comments
 (0)