wp-api-client icon indicating copy to clipboard operation
wp-api-client copied to clipboard

WpApiClient::Collection: Added accessor to get total pages for a cust…

Open gadikotamohan opened this issue 6 years ago • 8 comments

WpApiClient::Collection: Added accessor to get total pages for a custom post_type posts

gadikotamohan avatar Jun 08 '19 17:06 gadikotamohan

@duncanjbrown Could review ?

gadikotamohan avatar Jun 09 '19 07:06 gadikotamohan

Thank you! Would you mind adding a spec?

duncanjbrown avatar Jun 10 '19 10:06 duncanjbrown

@duncanjbrown added spec please review..

mgadikota-rpx avatar Jul 08 '19 19:07 mgadikota-rpx

WpApiClient::Collection
  fetching posts of a certain post type
    returns an array of posts
    can paginate
    accepts array and non-array input
    responds to array methods
    should respond to total_pages and total_available
    should respond to total_pages and total_available
WARNING: Using the `raise_error` matcher without providing a specific error or message risks false positives, since `raise_error` will match when Ruby raises a `NoMethodError`, `NameError` or `ArgumentError`, potentially allowing the expectation to pass without even executing the method you are intending to call. Actual error raised was #<WpApiClient::ErrorResponse: WpApiClient::ErrorResponse>. Instead consider providing a specific error class or message. This message can be suppressed by setting: `RSpec::Expectations.configuration.on_potential_false_positives = :nothing`. Called from /Users/mohan/WorkSpace/playground/wp-api-client/spec/collection_spec.rb:53:in `block (3 levels) in <top (required)>'.
    throws an error when it tries to parse an error response

WpApiClient::Collection
  fetching posts concurrently
    allows simultaneous fetching of posts

WpApiClient::Entities::Base
  general entity methods
    work to retrieve embedded hypermedia
    work to retrieve non-embedded hypermedia
    allows querying on specific relations from posts to terms
    allows querying on specific relations from terms to posts

WpApiClient::Entities::Error
  an API access error
    throws an exception
    recognises the error JSON exception

WpApiClient::Entities::Image
  calling instance methods on an image object
    returns the URL for different sizes

WpApiClient::Entities::Post
  calling instance methods on a post
    returns the title
    returns the date as a Time object
    returns the content as HTML
    returns its own ID
    returns its own slug
    allows its internal resource to be queried directly
    returns its author
  meta function
    returns an individual meta value
    caches
    returns the right items from cache

WpApiClient::Relationship
  relationships with terms
    presents term objects as a set of key/value collections
  relationships with posts
    returns an collection of posts
  relationships with featured images
    returns an collection of posts
  relationships with metadata
    returns an hash of meta

WpApiClient::Entities::Taxonomy
  calling instance methods on a taxonomy
    returns the name
    returns a collection of terms

WpApiClient::Entities::Term
  reading data out of the term
    returns the name
    returns the slug
    returns a taxonomy object
  a term connected to two different post types
    returns two collections of posts

WpApiClient::Entities::User
  calling instance methods on a user
    returns the id

WpApiClient
  has a version number

WpApiClient::Configuration
  #configure
    can set the endpoint URL for the API connection
    can specify whether or not to request embedded resources
    can set up OAuth credentials
    can set up link relationships
    exposes a #proxy configuration option

Finished in 0.40895 seconds (files took 0.64956 seconds to load)
42 examples, 0 failures


mgadikota-rpx avatar Jul 08 '19 19:07 mgadikota-rpx

@duncanjbrown Please find rspec result in https://travis-ci.org/gadikotamohan/wp-api-client

gadikotamohan avatar Jul 08 '19 19:07 gadikotamohan

@duncanjbrown made suggested changes to code and please find rpsec status in https://travis-ci.org/gadikotamohan/wp-api-client/builds/556100532 (all specs are green)

gadikotamohan avatar Jul 09 '19 03:07 gadikotamohan

Hi @duncanjbrown got a chance to look into this ?

gadikotamohan avatar Jul 15 '19 17:07 gadikotamohan

hi @duncanjbrown, have you got a chance to look into this PR ?

mgadikota-rpx avatar Nov 26 '19 07:11 mgadikota-rpx