Content-Length: 437955 | pFad | http://github.com/r7kamura/rdmm/commit/39992c2b03f887b40636a777a9060123ae24901e

85 Add more methods on item resource · r7kamura/rdmm@39992c2 · GitHub
Skip to content

Commit

Permalink
Add more methods on item resource
Browse files Browse the repository at this point in the history
  • Loading branch information
r7kamura committed Feb 9, 2017
1 parent 4dd9035 commit 39992c2
Show file tree
Hide file tree
Showing 3 changed files with 190 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
- Fix bug on `Rdmm::Resources::ItemResource#affiliate_url`
- Fix bug on `Rdmm::Resources::ItemResource#url`
- Rename `#affiliate_url` to `#url_affiliate` on `Rdmm::Resources::ItemResource`
- Remove `#prices` on `Rdmm::Resources::ItemResource`
- Add more methods on `Rdmm::Resources::ItemResource`

## 0.2.0

Expand Down
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -238,26 +238,50 @@ Available attributes:

- `#actors`
- `#actresses`
- `#affiliate_url`
- `#authors`
- `#bandai_title_code`
- `#category_name`
- `#cd_kind`
- `#compatible_with_pc?`
- `#compatible_with_sp?`
- `#content_id`
- `#directors`
- `#floor_code`
- `#floor_name`
- `#genres`
- `#isbn`
- `#jancode`
- `#labels`
- `#maker_product`
- `#makers`
- `#prices`
- `#number`
- `#price`
- `#price`
- `#price_deliveries`
- `#product_id`
- `#released_at`
- `#review_average`
- `#review_count`
- `#series`
- `#service_code`
- `#service_name`
- `#stock`
- `#stock`
- `#title`
- `#url`
- `#url_affiliate`
- `#url_image_large`
- `#url_image_list`
- `#url_image_samples`
- `#url_image_small`
- `#url_movie_sample_size_476_306`
- `#url_movie_sample_size_560_360`
- `#url_movie_sample_size_644_414`
- `#url_movie_sample_size_720_480`
- `#url_sp`
- `#url_sp_affiliate`
- `#url_tachiyomi`
- `#url_tachiyomi_affiliate`
- `#volume`

### Rdmm::Resources::MakerResource
Expand Down
165 changes: 162 additions & 3 deletions lib/rdmm/resources/item_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,39 @@ def authors
Array(source["iteminfo"]["author"])
end

# @return [String, nil]
def bandai_title_code
if source["bandaiinfo"]
source["bandaiinfo"]["titlecode"]
end
end

# @return [String, nil]
def category_name
source["category_name"]
end

# @return [String, nil]
def cd_kind
if source["cdinfo"]
source["cdinfo"]["kind"]
end
end

# @return [Boolean, nil]
def compatible_with_pc?
if source["sampleMovieURL"]
source["sampleMovieURL"]["pc_flag"]
end
end

# @return [Boolean, nil]
def compatible_with_sp?
if source["sampleMovieURL"]
source["sampleMovieURL"]["sp_flag"]
end
end

# @return [String, nil]
def content_id
source["content_id"]
Expand All @@ -48,26 +76,70 @@ def genres
Array(source["iteminfo"]["genre"])
end

# @return [String, nil]
def isbn
source["isbn"]
end

# @return [String, nil]
def jancode
source["jancode"]
end

# @return [Array]
def labels
Array(source["iteminfo"]["label"])
end

# @return [String, nil]
def maker_product
source["maker_product"]
end

# @return [Array]
def makers
Array(source["iteminfo"]["maker"])
end

# @return [Hash, nil]
def prices
source["prices"]
# @return [Integer, nil]
def number
source["number"]
end

# @return [String, nil]
def price
if source["prices"]
source["prices"]["price"]
end
end

# @return [Array<Hash>]
def price_deliveries
if source["prices"] && source["prices"]["deliveries"] && source["prices"]["deliveries"]["delivery"]
source["prices"]["deliveries"]["delivery"]
else
[]
end
end

# @note May not be a Integer
# @return [Integer, nil]
def price
if source["prices"]
source["prices"]["proper"]
end
end

# @return [String, nil]
def product_id
source["product_id"]
end

# @return [String, nil]
def stock
source["stock"]
end

# @return [Time, nil]
def released_at
if source["date"]
Expand Down Expand Up @@ -100,6 +172,11 @@ def service_name
source["service_name"]
end

# @return [Object]
def stock
source["stock"]
end

# @return [String, nil]
def title
source["title"]
Expand All @@ -115,6 +192,88 @@ def url_affiliate
source["affiliateURL"]
end

# @return [String, nil]
def url_image_large
if source["imageURL"]
source["imageURL"]["large"]
end
end

# @return [String, nil]
def url_image_list
if source["imageURL"]
source["imageURL"]["list"]
end
end

# @return [String, nil]
def url_image_small
if source["imageURL"]
source["imageURL"]["small"]
end
end

# @return [Array<String>]
def url_image_samples
if source["sampleImageURL"] && source["sampleImageURL"]["sample_s"] && source["sampleImageURL"]["sample_s"]["image"]
source["sampleImageURL"]["sample_s"]["image"]
else
[]
end
end

# @return [String, nil]
def url_movie_sample_size_476_306
if source["sampleMovieURL"]
source["sampleMovieURL"]["size_476_306"]
end
end

# @return [String, nil]
def url_movie_sample_size_560_360
if source["sampleMovieURL"]
source["sampleMovieURL"]["size_560_360"]
end
end

# @return [String, nil]
def url_movie_sample_size_644_414
if source["sampleMovieURL"]
source["sampleMovieURL"]["size_644_414"]
end
end

# @return [String, nil]
def url_movie_sample_size_720_480
if source["sampleMovieURL"]
source["sampleMovieURL"]["size_720_480"]
end
end

# @return [String, nil]
def url_sp
source["URLsp"]
end

# @return [String, nil]
def url_sp_affiliate
source["affiliateURLsp"]
end

# @return [String, nil]
def url_tachiyomi
if source["tachiyomi"]
source["tachiyomi"]["URL"]
end
end

# @return [String, nil]
def url_tachiyomi_affiliate
if source["tachiyomi"]
source["tachiyomi"]["affilaiteURL"]
end
end

# @return [Integer, nil]
def volume
source["volume"]
Expand Down

0 comments on commit 39992c2

Please sign in to comment.








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/r7kamura/rdmm/commit/39992c2b03f887b40636a777a9060123ae24901e

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy