nyt_search 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a4ffb4d304aa573af6de16ba43e68692bd2dba06
4
- data.tar.gz: 9e1199032697a8c3a7497041618130fb3dda1008
3
+ metadata.gz: b88d9e94bba85041a03bc51b5f3b0a83a670624c
4
+ data.tar.gz: f9deb3fa48bc351dd94136a5f70fef062ccd5869
5
5
  SHA512:
6
- metadata.gz: 5903d81e4c3f82788263bdf009b58a7aebca53a6859156ec6ea2e1959c750d1b7669531073b378ed3f2189b6b27fc2d3ac1447f8b5e71ec069e8caf7fb6fbf7d
7
- data.tar.gz: 44154c40bf641795cf89a27ddb5df4ebe6a2b2c85707fe50b7a4c5ea3631a6bcd190982aece97a199a88d39fbf09961fca37a037a81ac83b001bec8e48c81f91
6
+ metadata.gz: 59c187791fe0b7df766b538e13d1e55d061b70471ef47b7b1157595f5eae59fb7ad3675bf115fddc38a67115d341a9943697261dbc2d8d6f97c7151e5089b2fc
7
+ data.tar.gz: 68b84f6fee18a6420640441d9b07bfaa54596d3ed73aaf62a9b4792b004bfeda8c2a07dcd93ef8d15d14dfce0f3ba7c031212d4b38f466f2902d6199497859c6
data/README.md CHANGED
@@ -29,18 +29,40 @@ If rails, set it in *config/environments/*
29
29
  ## Usage
30
30
 
31
31
  ```
32
- @search = NytSearch::Article.search(query: "obama", sort: "newest", page: 2)['response']['docs']
32
+ @search = NytSearch::Article.search(query: "obama", sort: "newest", page: 2)
33
33
  ```
34
34
 
35
- Available options: [
36
- ```
37
- query,
38
- sort(newest, oldest),
39
- page,
40
- begin_date(YYYYMMDD),
41
- end_date(YYYYMMDD)
42
- ```
43
- ]
35
+ **Available options**:
36
+ ```
37
+ query
38
+ sort(newest, oldest)
39
+ page
40
+ begin_date(YYYYMMDD)
41
+ end_date(YYYYMMDD)
42
+ only("headline,web_url") #hash will have only this fields
43
+ ```
44
+
45
+ **Limits the fields returned in your search results. By default (unless you include an "only" list in your request), the following fields are returned**:
46
+
47
+ ```
48
+ web_url
49
+ snippet
50
+ lead_paragraph
51
+ abstract
52
+ print_page
53
+ blog
54
+ source
55
+ multimedia
56
+ headline
57
+ keywords
58
+ pub_date
59
+ document_type
60
+ news_desk
61
+ byline
62
+ type_of_material
63
+ _id
64
+ word_count
65
+ ```
44
66
 
45
67
  ## Contributing
46
68
 
@@ -6,6 +6,12 @@ module NytSearch
6
6
  url += "&sort=#{options[:sort]}" if options[:sort]
7
7
  url += "&begin_date=#{options[:begin_date]}" if options[:begin_date]
8
8
  url += "&end_date=#{options[:end_date]}" if options[:end_date]
9
+
10
+ if options[:fields]
11
+ fields = options[:fields].delete(' ')
12
+ url += "&fl=#{fields}"
13
+ end
14
+
9
15
  NytSearch::Api.get_json(url)['response']['docs']
10
16
  end
11
17
  end
@@ -1,3 +1,3 @@
1
1
  module NytSearch
2
- VERSION = "0.1.1"
3
- end
2
+ VERSION = "0.1.2"
3
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nyt_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaliy
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-16 00:00:00.000000000 Z
11
+ date: 2015-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler